/* PokeDex — pixel-arcade × Solana trading aesthetic
   ──────────────────────────────────────────────── */

:root {
  /* Theme palettes — overridden by Tweaks */
  --pd-bg:        #0c0f1e;
  --pd-bg-2:      #141934;
  --pd-paper:     #f1e9d2;
  --pd-paper-2:   #e0d3a8;
  --pd-ink:       #14172b;
  --pd-ink-2:     #2a2f55;
  --pd-line:      #14172b;

  --pd-red:       #e53935;
  --pd-red-deep:  #b71c1c;
  --pd-yellow:    #ffce3a;
  --pd-yellow-2:  #ffa800;
  --pd-blue:      #2746c3;
  --pd-blue-2:    #4361ee;
  --pd-cyan:      #5ad8ff;
  --pd-green:     #2bd16b;
  --pd-pink:      #ff7ab6;
  --pd-purple:    #a259ff;

  --pd-up:        #2bd16b;
  --pd-down:      #ff5a5a;

  --pd-pixel:     'Press Start 2P', system-ui, sans-serif;
  --pd-mono:      'VT323', 'JetBrains Mono', ui-monospace, monospace;
  --pd-body:      'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;

  --pd-shadow-hard: 6px 6px 0 0 var(--pd-line);
  --pd-shadow-soft: 0 10px 30px rgba(0,0,0,.45);

  --pd-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .12 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/></svg>");
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--pd-bg);
  color: var(--pd-paper);
  font-family: var(--pd-body);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(229,57,53,.18), transparent 70%),
    radial-gradient(ellipse 60% 50% at 100% 40%, rgba(39,70,195,.22), transparent 70%),
    radial-gradient(ellipse 60% 50% at 0% 70%, rgba(255,206,58,.12), transparent 70%),
    linear-gradient(180deg, #0c0f1e 0%, #0a0d1c 50%, #0c0f1e 100%);
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: var(--pd-grain);
  opacity: .35;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}

/* CRT scanlines */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0) 0px,
    rgba(255,255,255,0) 2px,
    rgba(0,0,0,.06) 2px,
    rgba(0,0,0,.06) 3px
  );
  pointer-events: none;
  z-index: 2;
  opacity: .35;
}

#root { position: relative; z-index: 3; }

/* ── Typography helpers ── */
.pixel { font-family: var(--pd-pixel); letter-spacing: .02em; }
.mono  { font-family: var(--pd-mono);  letter-spacing: .01em; }

.pd-h1 { font-family: var(--pd-pixel); font-size: clamp(36px, 6vw, 72px); line-height: 1.05; letter-spacing: .01em; text-wrap: balance; }
.pd-h1--hero { font-size: clamp(30px, 4.6vw, 56px); line-height: 1.08; text-wrap: balance; }
.pd-h2 { font-family: var(--pd-pixel); font-size: clamp(22px, 2.8vw, 36px); line-height: 1.1; text-wrap: balance; }
.pd-h3 { font-family: var(--pd-pixel); font-size: clamp(14px, 1.4vw, 18px); line-height: 1.2; text-wrap: balance; }
.pd-eyebrow { font-family: var(--pd-pixel); font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--pd-yellow); }

/* ── Pixel card ── */
.pd-card {
  position: relative;
  background: var(--pd-paper);
  color: var(--pd-ink);
  border: 4px solid var(--pd-line);
  border-radius: 6px;
  box-shadow: var(--pd-shadow-hard);
}
.pd-card--dark {
  background: var(--pd-bg-2);
  color: var(--pd-paper);
  border-color: #2a2f55;
  box-shadow: 6px 6px 0 0 #050615;
}
.pd-card--glow {
  box-shadow:
    var(--pd-shadow-hard),
    0 0 0 1px rgba(255,206,58,.4),
    0 0 32px rgba(255,206,58,.18);
}

.pd-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  font-family: var(--pd-pixel);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 2px solid currentColor;
  border-radius: 2px;
  background: rgba(0,0,0,.15);
  white-space: nowrap;
}

.pd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 22px;
  font-family: var(--pd-pixel);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pd-paper);
  background: var(--pd-red);
  border: 4px solid var(--pd-line);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 4px 4px 0 0 var(--pd-line);
  transform: translate(0,0);
  transition: transform .08s ease, box-shadow .08s ease, background .15s;
  text-decoration: none;
}
.pd-btn:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 0 var(--pd-line); }
.pd-btn:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 0 var(--pd-line); }
.pd-btn--yellow { background: var(--pd-yellow); color: var(--pd-ink); }
.pd-btn--green  { background: var(--pd-green); color: var(--pd-ink); }
.pd-btn--blue   { background: var(--pd-blue);  color: #fff; }
.pd-btn--ghost  { background: transparent; color: var(--pd-paper); border-color: var(--pd-paper); box-shadow: 4px 4px 0 0 rgba(241,233,210,.4); }
.pd-btn--ghost:hover { box-shadow: 6px 6px 0 0 rgba(241,233,210,.4); }
.pd-btn--sm { padding: 10px 14px; font-size: 10px; }

/* ── Layout ── */
.pd-wrap { width: min(1320px, 92vw); margin: 0 auto; }

.section { padding: 80px 0; position: relative; }
.section-tight { padding: 48px 0; }

.divider-banner {
  background: var(--pd-red);
  color: #fff;
  padding: 14px 0;
  border-top: 4px solid var(--pd-line);
  border-bottom: 4px solid var(--pd-line);
  overflow: hidden;
}
.divider-banner__inner {
  display: flex; gap: 60px;
  font-family: var(--pd-pixel);
  font-size: 14px;
  white-space: nowrap;
  animation: marquee 30s linear infinite;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── Pokeball ── */
.pokeball {
  --pb-size: 240px;
  --pb-red: var(--pd-red);
  --pb-white: var(--pd-paper);
  width: var(--pb-size); height: var(--pb-size);
  position: relative;
  filter: drop-shadow(8px 8px 0 var(--pd-line));
}
.pokeball__top, .pokeball__bot {
  position: absolute; left: 0; width: 100%; height: 50%;
  border: 6px solid var(--pd-line);
}
.pokeball__top { top: 0; background: var(--pb-red); border-radius: 50% 50% 0 0 / 100% 100% 0 0; border-bottom: 3px solid var(--pd-line); }
.pokeball__bot { bottom: 0; background: var(--pb-white); border-radius: 0 0 50% 50% / 0 0 100% 100%; border-top: 3px solid var(--pd-line); }
.pokeball__band {
  position: absolute; left: 0; right: 0; top: 50%; height: 8px;
  background: var(--pd-line); transform: translateY(-50%);
}
.pokeball__btn {
  position: absolute; left: 50%; top: 50%;
  width: 28%; height: 28%;
  background: var(--pb-white);
  border: 6px solid var(--pd-line);
  border-radius: 50%;
  transform: translate(-50%,-50%);
  box-shadow: inset 0 0 0 4px var(--pb-white), inset 0 0 0 6px rgba(0,0,0,.12);
}
.pokeball__btn::after {
  content: '';
  position: absolute;
  width: 38%; height: 38%; top: 22%; left: 22%;
  background: rgba(255,255,255,.55);
  border-radius: 50%;
}
.pokeball--shake { animation: pb-shake 1.6s ease-in-out infinite; }
@keyframes pb-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(4deg); }
}
.pokeball--spin { animation: pb-spin 1.4s linear infinite; }
@keyframes pb-spin { to { transform: rotate(360deg); } }

/* ── Ticker ── */
.ticker {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 16px;
  background: var(--pd-bg-2);
  border-top: 3px solid var(--pd-line);
  border-bottom: 3px solid var(--pd-line);
  overflow: hidden;
}
.ticker__track { display: flex; gap: 32px; white-space: nowrap; animation: marquee 50s linear infinite; }
.ticker__item { font-family: var(--pd-mono); font-size: 20px; display: inline-flex; gap: 10px; align-items: center; }
.ticker__num { color: var(--pd-yellow); }
.ticker__up { color: var(--pd-up); }
.ticker__down { color: var(--pd-down); }

/* ── Sprite (creature placeholder) ── */
.sprite {
  width: 100%; aspect-ratio: 1;
  image-rendering: pixelated;
  display: grid;
  place-items: center;
  position: relative;
}

/* ── HP bar (battle) ── */
.hpbar {
  height: 14px;
  background: #1a1d3a;
  border: 3px solid var(--pd-line);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.hpbar__fill {
  height: 100%;
  background: linear-gradient(180deg, #6fff9a 0%, var(--pd-green) 100%);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.hpbar__fill.low { background: linear-gradient(180deg, #ffb84d, #ff7a00); }
.hpbar__fill.crit { background: linear-gradient(180deg, #ff7a7a, var(--pd-down)); }

/* ── Pokedex grid ── */
.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.dex-card {
  position: relative;
  aspect-ratio: 1;
  background: var(--pd-paper);
  border: 3px solid var(--pd-line);
  border-radius: 4px;
  padding: 10px;
  display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer;
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: 3px 3px 0 0 var(--pd-line);
}
.dex-card:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 0 var(--pd-line); }
.dex-card__num {
  font-family: var(--pd-mono);
  font-size: 18px;
  color: var(--pd-ink);
  opacity: .55;
}
.dex-card__name {
  font-family: var(--pd-pixel);
  font-size: 9px;
  color: var(--pd-ink);
  text-transform: uppercase;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.dex-card__price {
  font-family: var(--pd-mono);
  font-size: 14px;
  color: var(--pd-ink);
}
.dex-card__delta { font-family: var(--pd-mono); font-size: 13px; }
.dex-card--locked { background: repeating-linear-gradient(45deg, #2a2f55 0 8px, #1f234a 8px 16px); color: #565a85; }
.dex-card--locked .dex-card__name,
.dex-card--locked .dex-card__num,
.dex-card--locked .dex-card__price { color: #8a8eb5; }
.dex-card.is-active { box-shadow: 0 0 0 3px var(--pd-yellow), 5px 5px 0 0 var(--pd-line); }

/* Rarity tints */
.dex-card[data-rarity="common"]    { background: var(--pd-paper); }
.dex-card[data-rarity="uncommon"]  { background: #c8e6c9; }
.dex-card[data-rarity="rare"]      { background: #bbdefb; }
.dex-card[data-rarity="epic"]      { background: #e1bee7; }
.dex-card[data-rarity="legendary"] { background: linear-gradient(135deg, #fff3c4, #ffce3a); }

/* ── Number ticker ── */
.numroll { font-variant-numeric: tabular-nums; transition: color .2s; }

/* ── Section labels ── */
.section-label {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--pd-pixel); font-size: 11px;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--pd-yellow);
  margin-bottom: 16px;
}
.section-label::before, .section-label::after {
  content: ''; width: 20px; height: 2px; background: currentColor;
}

/* ── Utility ── */
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.center { align-items: center; justify-content: center; }
.between { justify-content: space-between; }

/* Star burst behind hero */
.starfield {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 30% 70%, #fff 50%, transparent 50%),
    radial-gradient(2px 2px at 60% 40%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 80% 80%, #fff 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 45% 15%, #ffce3a 50%, transparent 50%),
    radial-gradient(1px 1px at 90% 30%, #5ad8ff 50%, transparent 50%);
  opacity: .55;
  pointer-events: none;
}

/* Pulse */
.pulse-dot {
  display: inline-block; width: 8px; height: 8px;
  background: var(--pd-up); border-radius: 50%;
  box-shadow: 0 0 0 0 var(--pd-up);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(43,209,107,.7); }
  70%  { box-shadow: 0 0 0 10px rgba(43,209,107,0); }
  100% { box-shadow: 0 0 0 0 rgba(43,209,107,0); }
}

/* Float */
.float { animation: float 5s ease-in-out infinite; }
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-12px); }
}

/* Decorative grid bg for sections */
.grid-bg {
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ──────────────────────────────────────────────────────────────────
   GLOBAL RESPONSIVE LAYER
   Targets all the inline `display: grid; gridTemplateColumns: ...`
   that React components write. Collapses to 1 column on phones.
   ────────────────────────────────────────────────────────────────── */

/* Tablets and below */
@media (max-width: 980px) {
  .pd-wrap { width: 92vw; }
  .section { padding: 48px 0; }
  .section-tight { padding: 32px 0; }

  /* Nav: hide section links here, keep just logo + Pump.fun + Connect.
     (Phone breakpoint below also hides the ghost btn.) */
  nav .pixel[href^="#"] { display: none; }
  nav .row { gap: 12px !important; }

  /* 2-col + 3-col grids collapse to 1 col */
  .section [style*="grid-template-columns: 1fr 1fr"],
  .section [style*="grid-template-columns: 1.1fr 1fr"],
  .section [style*="grid-template-columns: 1.15fr 1fr"],
  .section [style*="grid-template-columns: 1.2fr 1fr"],
  .section [style*="grid-template-columns: 1.4fr 1fr"],
  .section [style*="grid-template-columns: repeat(2, 1fr)"],
  .section [style*="grid-template-columns: repeat(3, 1fr)"],
  .section [style*="grid-template-columns: repeat(4, 1fr)"],
  .section [style*="grid-template-columns: repeat(5, 1fr)"],
  footer [style*="1.4fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  /* Pokedex tile size */
  .dex-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  /* Rarity legend — 2 then 1 col on small */
  .pd-card[style*="repeat(5, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Headings */
  .pd-h1 { font-size: clamp(28px, 9vw, 48px); }
  .pd-h2 { font-size: clamp(18px, 5vw, 28px); }
}

/* Phones */
@media (max-width: 720px) {
  .pd-wrap { width: 94vw; }
  .section { padding: 32px 0; }

  /* Nav: hide ghost button on phone (section links already hidden at 980px) */
  nav .pd-btn--ghost { display: none; }

  /* Marquee speed */
  .ticker__item { font-size: 16px; }
  .divider-banner__inner { font-size: 12px; }

  /* Buttons shrink */
  .pd-btn { padding: 12px 14px; font-size: 10px; }
  .pd-btn--sm { padding: 8px 10px; font-size: 9px; }

  /* Dex grid */
  .dex-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
  }
  .dex-card { padding: 8px; }
  .dex-card__num { font-size: 14px; }
  .dex-card__name { font-size: 8px; }
  .dex-card__price { font-size: 11px; }
  .dex-card__delta { font-size: 10px; }

  /* Rarity legend */
  .pd-card[style*="repeat(5, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Section labels / chips */
  .pd-chip { font-size: 8px; padding: 3px 6px; }

  /* Footer */
  footer .row.between { flex-direction: column; gap: 14px; }

  /* Modal padding */
  .pd-card[style*="min(820px"] { padding: 18px !important; }
  .pd-card[style*="min(820px"] .row { flex-direction: column !important; gap: 18px !important; }
  .pd-card[style*="min(820px"] .row > .col { width: 100% !important; }

  /* Modal close button — keep visible */
  .pd-card .pd-btn--sm[style*="position: absolute"] { top: 8px !important; right: 8px !important; }

  /* Tweaks panel — shrink */
  .twk-panel { width: calc(100vw - 20px) !important; max-width: 320px; }

  /* Battle screen — keep readable */
  .battle-screen-info {
    position: static !important;
    min-width: 0 !important;
    width: 100% !important;
    margin-bottom: 8px;
  }
  .battle-screen-sprite {
    position: static !important;
    margin: 0 auto !important;
    display: block !important;
  }
  .battle-screen-field {
    min-height: 280px !important;
    padding: 12px !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .battle-screen-bottom {
    grid-template-columns: 1fr !important;
  }
  .battle-screen-bottom > div:first-child {
    border-right: none !important;
    border-bottom: 4px solid var(--pd-line);
  }

  /* Headings tighter */
  .pd-h1 { font-size: 30px; line-height: 1.05; }
  .pd-h2 { font-size: 18px; }
  .section-label { font-size: 9px; }
}

/* Very small phones */
@media (max-width: 380px) {
  .pd-wrap { width: 96vw; }
  .pokeball { --pb-size: 140px !important; }
  .dex-grid {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  }
}

/* ── Hero viewport fit ── */
/* Total above-fold = sticky nav (~68px) + hero + marquee (~50px).
   So hero = 100vh - 68px - 50px = ~viewport - 118px, leaving the
   marquee visible at the bottom of the fold. */
.hero-section {
  min-height: calc(100vh - 118px);
  min-height: calc(100svh - 118px);
  height: calc(100vh - 118px);
  height: calc(100svh - 118px);
  display: flex;
  align-items: center;
  padding: 32px 0;
}
.hero-wrap { width: min(1120px, 92vw); }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
  align-items: center;
  width: 100%;
}
.hero-title {
  font-size: clamp(34px, 5.6vw, 64px) !important;
  line-height: 1.05 !important;
}
.hero-lede {
  font-size: clamp(15px, 1.2vw, 17px);
}
.hero-stat-num { font-size: clamp(20px, 1.9vw, 26px); }

/* Smaller screens — stack vertically and let it grow */
@media (max-width: 980px) {
  .hero-section {
    height: auto;
    min-height: calc(100vh - 118px);
    padding: 40px 0;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* Very short screens — release the lock so content isn't cramped */
@media (max-height: 760px) {
  .hero-section {
    height: auto;
    min-height: 0;
    padding: 32px 0;
  }
  .hero-title { font-size: clamp(28px, 4.6vw, 48px) !important; }
}
