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

:root {
  --bg-main: #050906;
  --bg-card: #08110c;
  --bg-card-hover: #0c1812;
  --bg-card-border: #15271d;
  --emerald-accent: #00e676;
  --emerald-glow: rgba(0, 230, 118, 0.35);
  --gold-accent: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.2);
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --red-accent: #ef4444;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

*, *:before, *:after {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(0, 230, 118, 0.08), transparent),
    radial-gradient(ellipse 40% 30% at 85% 20%, rgba(0, 200, 5, 0.05), transparent);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--sat);
  padding-bottom: var(--sab);
  padding-left: var(--sal);
  padding-right: var(--sar);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ensure no elements cause horizontal page overflow */
main, section, div, header, footer {
  max-width: 100%;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Universal Text & Blockchain Address Wrapping */
.break-words-safe,
.mono,
[data-address],
[id*="address"],
[id*="contract"],
[id*="hash"],
[id*="ca-"] {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Responsive media elements */
img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #040805;
}
::-webkit-scrollbar-thumb {
  background: #14281e;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #1f3d2e;
}

/* Glowing Elements */
.glow-emerald {
  box-shadow: 0 0 25px var(--emerald-glow);
}
.glow-text-emerald {
  text-shadow: 0 0 15px rgba(0, 230, 118, 0.6);
}

/* Reference UI Cards */
.glass-card {
  background: rgba(9, 17, 13, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: 16px;
  transition: all 0.2s ease-in-out;
}
.glass-card:hover {
  border-color: #1f3d2c;
}

/* Neon Green Button matching reference design */
.btn-neon-green {
  background: #00e676;
  color: #030a05;
  font-weight: 800;
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 0 22px rgba(0, 230, 118, 0.35);
  letter-spacing: -0.01em;
  border: none;
}
.btn-neon-green:hover {
  background: #00ff88;
  box-shadow: 0 0 32px rgba(0, 230, 118, 0.6);
  transform: translateY(-1px);
}
.btn-neon-green:active {
  transform: translateY(1px) scale(0.98);
}

/* Dark Icon Button matching reference design */
.icon-btn-dark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #08110c;
  border: 1px solid #16271e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: all 0.2s;
  cursor: pointer;
}
.icon-btn-dark:hover {
  color: #ffffff;
  border-color: #00e676;
  background: #0f1e16;
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.2);
}

/* Wallet Pill Button matching reference design */
.wallet-pill {
  padding: 7px 14px;
  border-radius: 12px;
  background: #060d08;
  border: 1px solid #00e676;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 14px rgba(0, 230, 118, 0.2);
  cursor: pointer;
  transition: all 0.2s;
}
.wallet-pill:hover {
  background: #0b1910;
  box-shadow: 0 0 22px rgba(0, 230, 118, 0.35);
  border-color: #00ff88;
}

/* Ticker marquee animation */
@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 35s linear infinite;
}
.ticker-track:hover {
  animation-play-state: paused;
}

/* Button styles */
.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #041009;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.65rem 1.35rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  letter-spacing: -0.01em;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(1px) scale(0.98);
}

.btn-secondary {
  background: rgba(13, 27, 19, 0.85);
  backdrop-filter: blur(8px);
  color: #f3f4f6;
  border: 1px solid #1f3d2b;
  border-radius: 12px;
  padding: 0.65rem 1.35rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.01em;
}
.btn-secondary:hover {
  background: #172f22;
  border-color: rgba(16, 185, 129, 0.6);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}
.btn-secondary:active {
  transform: translateY(1px) scale(0.98);
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0b120c;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 0.625rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-gold:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

/* Tab active indicator matching reference design */
.nav-tab {
  position: relative;
  font-weight: 500;
  color: #94a3b8;
  padding: 0.5rem 0.85rem;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  background: transparent;
}
.nav-tab:hover {
  color: #ffffff;
}
.nav-tab.active {
  color: #ffffff;
  font-weight: 700;
  background: transparent;
}
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  min-width: 24px;
  height: 2.5px;
  background: #00e676;
  border-radius: 9999px;
  box-shadow: 0 0 12px #00e676;
}

/* Flash effect for trade updates */
@keyframes flashGreen {
  0% { background-color: rgba(16, 185, 129, 0.4); }
  100% { background-color: transparent; }
}
@keyframes flashRed {
  0% { background-color: rgba(239, 68, 68, 0.4); }
  100% { background-color: transparent; }
}
.flash-up {
  animation: flashGreen 1s ease-out;
}
.flash-down {
  animation: flashRed 1s ease-out;
}

/* Progress bar for bonding curve */
.curve-progress-bg {
  background: #14241c;
  border-radius: 9999px;
  overflow: hidden;
  height: 8px;
}
.curve-progress-bar {
  background: linear-gradient(90deg, #10b981, #f59e0b);
  height: 100%;
  transition: width 0.4s ease;
  border-radius: 9999px;
}

/* Toast container */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 12px 18px;
  border-radius: 8px;
  background: #0e1c15;
  border: 1px solid #1f3a2c;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM (MOBILE-FIRST TO ULTRAWIDE)
   ========================================================================== */

/* 1. Fluid Typography & Elements */
.fluid-hero-headline {
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  line-height: 0.95;
}
.fluid-hero-sub {
  font-size: clamp(0.875rem, 2.5vw, 1.05rem);
}
.fluid-price-display {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
}

/* 2. Responsive Tables and Data Boxes */
.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* 3. Hero Monolith Sizing */
.hero-monolith-box {
  width: 100%;
  max-height: clamp(220px, 35vh, 440px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-monolith-box img {
  max-height: clamp(220px, 35vh, 440px);
  width: auto;
  object-fit: contain;
}

/* 4. Responsive Modal Dialog */
.modal-dialog-adaptive {
  width: min(calc(100vw - 24px), 520px);
  max-height: min(calc(100dvh - 32px), 740px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: auto;
}

/* 5. Mobile Navigation Drawer */
#mobile-nav-drawer {
  animation: drawerSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes drawerSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.nav-drawer-item {
  min-height: 48px;
  touch-action: manipulation;
}

/* 6. Touch Targets (Minimum 44px) on Mobile & Touch Devices */
@media (pointer: coarse), (max-width: 768px) {
  .btn-neon-green,
  .btn-primary,
  .btn-secondary,
  .wallet-pill,
  .icon-btn-dark,
  .nav-drawer-item,
  .nav-tab {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  #toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
  .toast {
    width: 100%;
    font-size: 0.85rem;
  }
}

/* 7. Ultra-Small Screens (<= 360px, e.g. iPhone SE 1st gen, Galaxy Fold closed) */
@media (max-width: 360px) {
  .wallet-pill {
    padding: 6px 10px;
    font-size: 11px;
    gap: 4px;
  }
  .btn-neon-green {
    padding: 0.65rem 1rem;
    font-size: 12px;
  }
  .fluid-hero-headline {
    font-size: 1.95rem;
  }
}

/* 8. Landscape Orientation on Mobile Devices (Short Viewport) */
@media (max-height: 520px) and (orientation: landscape) {
  header {
    position: relative; /* Avoid taking half the screen on short landscape mobile */
  }
  .modal-dialog-adaptive {
    max-height: calc(100dvh - 16px);
  }
  .hero-monolith-box {
    max-height: 180px;
  }
  .hero-monolith-box img {
    max-height: 180px;
  }
}

/* 9. Widescreen & Ultrawide Monitors (>= 1536px) */
@media (min-width: 1536px) {
  .max-w-7xl {
    max-width: 1440px;
    margin-inline: auto;
  }
}
