/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg:        #060914;
  --bg-2:      #0c1120;
  --bg-card:   rgba(255, 255, 255, 0.035);
  --bg-card-h: rgba(255, 255, 255, 0.065);
  --ink:       #e2eaff;
  --ink-soft:  rgba(226, 234, 255, 0.7);
  --ink-mute:  rgba(226, 234, 255, 0.35);
  --accent:    #00c8ff;
  --accent-2:  #7b2fff;
  --gain:      #00e887;
  --loss:      #ff3b5c;
  --line:      rgba(255, 255, 255, 0.07);
  --line-h:    rgba(255, 255, 255, 0.12);

  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:  "JetBrains Mono", "Fira Code", ui-monospace, monospace;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --nav-h: 64px;
  --r:     12px;
  --mx:    50%;
  --my:    50%;
}

/* =============================================================
   2. Reset & Base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.06; letter-spacing: -0.025em; font-weight: 700; }
input, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =============================================================
   3. Utilities
   ============================================================= */
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .5rem 1rem; background: var(--accent); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600; font-size: .85rem;
  transition: top .2s;
}
.skip-link:focus { top: 1rem; }

.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 48px);
}

.hidden-mobile { display: none; }

@media (min-width: 960px) { .hidden-mobile { display: revert; } }

/* =============================================================
   4. Scroll reveal
   ============================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}


/* =============================================================
   6. Nav
   ============================================================= */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  transition: background .3s, border-color .3s, backdrop-filter .3s;
}

.nav.is-scrolled {
  background: rgba(6, 9, 20, 0.85);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 48px);
}

.nav-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.nav-links {
  display: none;
  gap: 28px;
  align-items: center;
}

@media (min-width: 720px) {
  .nav-links { display: flex; }
}

.nav-links a {
  font-size: .9rem; font-weight: 500; color: var(--ink-soft);
  transition: color .2s;
}
.nav-links a:hover { color: var(--ink); }

.nav-ai-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: rgba(0,200,255,0.1);
  border: 1px solid rgba(0,200,255,0.25);
  border-radius: 8px;
  font-size: .85rem; font-weight: 600; color: var(--accent);
  transition: background .2s, border-color .2s, transform .2s var(--ease-bounce);
}
.nav-ai-btn:hover {
  background: rgba(0,200,255,0.18);
  border-color: rgba(0,200,255,0.5);
  transform: translateY(-1px);
}

.nav-menu-btn {
  display: flex; flex-direction: column; gap: 5px;
  padding: 6px; width: 36px; height: 36px;
  justify-content: center; align-items: center;
}
.nav-menu-btn span {
  display: block; width: 20px; height: 2px;
  background: var(--ink-soft); border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.nav-menu-btn[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav-menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-menu-btn[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

@media (min-width: 720px) { .nav-menu-btn { display: none; } }

/* Mobile nav open */
@media (max-width: 719px) {
  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: rgba(6,9,20,0.97);
    backdrop-filter: blur(20px);
    padding: 24px clamp(16px,4vw,48px);
    gap: 20px; border-bottom: 1px solid var(--line);
  }
}

/* =============================================================
   7. Hero
   ============================================================= */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding-top: var(--nav-h);
  overflow: hidden;
}

/* Mouse-reactive gradient */
.hero-gradient {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(circle 900px at var(--mx) var(--my), rgba(0,200,255,0.12) 0%, transparent 55%),
    radial-gradient(circle 700px at calc(var(--mx) + 12%) calc(var(--my) + 18%), rgba(123,47,255,0.10) 0%, transparent 55%),
    radial-gradient(circle 500px at calc(var(--mx) - 8%) calc(var(--my) - 12%), rgba(0,232,135,0.06) 0%, transparent 55%);
  filter: blur(2px);
  will-change: background;
}

.hero-glow {
  position: absolute;
  top: 20%; left: 50%; transform: translateX(-50%);
  width: 600px; height: 300px;
  background: radial-gradient(ellipse, rgba(0,200,255,0.08) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
  filter: blur(40px);
}

.hero-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding-inline: clamp(16px, 5vw, 60px);
  gap: 20px;
  max-width: 800px;
}

.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: clamp(.7rem, 1.2vw, .8rem);
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(0,200,255,0.08);
  border: 1px solid rgba(0,200,255,0.18);
  padding: 6px 14px; border-radius: 100px;
}

.kicker-dot {
  width: 6px; height: 6px;
  background: var(--gain);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.7); }
}

.hero-title {
  font-size: clamp(2.6rem, 7vw, 5.2rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
}
.hero-title em {
  font-style: italic;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: clamp(.95rem, 2vw, 1.1rem);
  color: var(--ink-soft);
  max-width: 520px;
  line-height: 1.7;
}

.hero-search-wrap { width: 100%; max-width: 520px; }

.hero-search {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line-h);
  border-radius: 14px;
  padding: 12px 20px;
  transition: border-color .25s, background .25s;
}
.hero-search:focus-within {
  border-color: rgba(0,200,255,0.4);
  background: rgba(255,255,255,0.07);
}
.hero-search svg { color: var(--ink-mute); flex-shrink: 0; }
.hero-search input {
  flex: 1; background: none; border: 0; outline: 0;
  font-size: 1rem; font-weight: 500; color: var(--ink);
}
.hero-search input::placeholder { color: var(--ink-mute); }

/* Ticker */
.ticker-wrap {
  position: absolute; bottom: 0; left: 0; right: 0;
  overflow: hidden;
  background: rgba(0,200,255,0.04);
  border-top: 1px solid var(--line);
  z-index: 1;
}

.ticker {
  display: flex; align-items: center;
  width: max-content;
  animation: ticker-scroll 60s linear infinite;
  gap: 0;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker { animation-play-state: paused; }
}

.tick-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px;
  font-family: var(--mono); font-size: .78rem; font-weight: 600;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.tick-item img { border-radius: 50%; }
.tick-item strong { color: var(--ink); }
.tick-item em { font-style: normal; }
.tick-item em.pos { color: var(--gain); }
.tick-item em.neg { color: var(--loss); }
.tick-placeholder { padding: 10px 24px; color: var(--ink-mute); font-size: .8rem; }

/* =============================================================
   8. Market Stats Bar
   ============================================================= */
.market-stats {
  background: rgba(255,255,255,0.025);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.market-stats .container {
  display: flex; gap: 0;
  overflow-x: auto; scrollbar-width: none;
}
.market-stats .container::-webkit-scrollbar { display: none; }

.stat-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 24px;
  border-right: 1px solid var(--line);
  white-space: nowrap; flex-shrink: 0;
}
.stat-item:last-child { border-right: 0; }

.stat-label {
  font-family: var(--mono); font-size: .68rem; font-weight: 400;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-mute);
}
.stat-value {
  font-family: var(--mono); font-size: .95rem; font-weight: 600;
  color: var(--ink);
}
.stat-change { font-family: var(--mono); font-size: .75rem; font-weight: 500; }
.stat-change.pos { color: var(--gain); }
.stat-change.neg { color: var(--loss); }

/* =============================================================
   9. AdSense Slots
   ============================================================= */
.adsense-slot {
  min-height: 90px;
  background: rgba(255,255,255,0.015);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.adsense-slot:empty::before {
  content: "Espacio publicitario";
  font-size: .7rem; color: var(--ink-mute);
  font-family: var(--mono); letter-spacing: .08em;
}
.adsense-mid { margin-block: 40px; min-height: 280px; }

/* =============================================================
   10. Market Section
   ============================================================= */
.market { padding-block: 48px 80px; }

.market-header {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 28px;
}
.market-header h2 {
  font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800;
}
.market-subtitle { font-size: .85rem; color: var(--ink-mute); }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 16px;
}

.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.filter-tab {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: .82rem; font-weight: 500;
  color: var(--ink-soft);
  border: 1px solid transparent;
  transition: background .18s, color .18s, border-color .18s;
}
.filter-tab:hover { background: var(--bg-card-h); color: var(--ink); }
.filter-tab.active {
  background: rgba(0,200,255,0.1);
  border-color: rgba(0,200,255,0.3);
  color: var(--accent);
}

.filter-right {
  display: flex; gap: 10px; align-items: center;
  margin-left: auto;
}

.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  transition: border-color .2s;
}
.search-bar:focus-within { border-color: rgba(0,200,255,0.35); }
.search-bar svg { color: var(--ink-mute); flex-shrink: 0; }
.search-bar input {
  background: none; border: 0; outline: 0;
  font-size: .85rem; width: 140px; color: var(--ink);
}
.search-bar input::placeholder { color: var(--ink-mute); }

select {
  background: #0c1120;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: .82rem; color: #e2eaff;
  cursor: pointer;
  outline: 0;
  transition: border-color .2s;
  color-scheme: dark;
}
select:focus { border-color: rgba(0,200,255,0.35); }
select option {
  background-color: #0c1120;
  color: #e2eaff;
}

/* Table header */
.coin-table-header {
  display: grid;
  grid-template-columns: 44px 1fr 130px 90px;
  padding: 8px 16px;
  font-family: var(--mono); font-size: .7rem; font-weight: 400;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-mute);
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
@media (min-width: 960px) {
  .coin-table-header {
    grid-template-columns: 44px 1fr 130px 90px 140px 130px 90px;
  }
}

/* Coin rows */
.coin-list { display: flex; flex-direction: column; gap: 2px; }

.coin-row {
  display: grid;
  grid-template-columns: 36px 1fr 110px 76px;
  column-gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--r);
  border: 1px solid transparent;
  transition: background .18s, border-color .18s, transform .18s var(--ease-out);
  cursor: pointer;
}

@media (min-width: 960px) {
  .coin-row {
    grid-template-columns: 44px 1fr 130px 90px 140px 130px 90px;
  }
}

.coin-row:hover {
  background: var(--bg-card-h);
  border-color: var(--line);
  transform: translateX(2px);
}

/* Skeleton */
.coin-row.skeleton { pointer-events: none; }

.sk {
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  height: 14px;
}
.sk-logo { width: 32px; height: 32px; border-radius: 50%; }
.sk-name { width: 80px; height: 14px; }
.cr-rank.sk { width: 20px; }
.cr-price.sk { width: 90px; }
.cr-change.sk { width: 60px; }
.cr-mcap.sk { width: 100px; }
.cr-vol.sk { width: 90px; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.cr-rank {
  font-family: var(--mono); font-size: .8rem; color: var(--ink-mute);
  font-weight: 400;
}

.cr-coin {
  display: flex; align-items: center; gap: 10px;
}
.cr-coin img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.cr-coin-info { display: flex; flex-direction: column; gap: 1px; }
.cr-name { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.cr-symbol { font-family: var(--mono); font-size: .7rem; color: var(--ink-mute); text-transform: uppercase; }
.cr-mcap-inline { font-family: var(--mono); font-size: .67rem; color: var(--ink-mute); margin-top: 1px; }
@media (min-width: 960px) { .cr-mcap-inline { display: none; } }

.cr-price {
  font-family: var(--mono); font-size: .88rem; font-weight: 600;
  text-align: right;
  transition: color .3s;
}
.cr-price.flash-up { animation: flash-green .7s; }
.cr-price.flash-down { animation: flash-red .7s; }

@keyframes flash-green {
  0%, 100% { color: var(--ink); }
  40% { color: var(--gain); }
}
@keyframes flash-red {
  0%, 100% { color: var(--ink); }
  40% { color: var(--loss); }
}

.cr-change {
  font-family: var(--mono); font-size: .82rem; font-weight: 500;
  padding: 3px 8px; border-radius: 6px;
  width: fit-content;
}
.cr-change.pos { color: var(--gain); background: rgba(0,232,135,0.1); }
.cr-change.neg { color: var(--loss); background: rgba(255,59,92,0.1); }

.cr-mcap, .cr-vol {
  font-family: var(--mono); font-size: .82rem; color: var(--ink-soft);
}

.cr-spark svg { width: 80px; height: 32px; }

/* No results / errors */
.no-results, .load-error {
  padding: 60px 24px; text-align: center; color: var(--ink-soft);
}
.load-error .btn-retry {
  margin-top: 16px; padding: 10px 24px;
  background: rgba(0,200,255,0.1); border: 1px solid rgba(0,200,255,0.3);
  border-radius: 10px; color: var(--accent); font-weight: 600;
  transition: background .2s;
}
.load-error .btn-retry:hover { background: rgba(0,200,255,0.2); }

/* Load more */
.load-more-wrap { display: flex; justify-content: center; margin-top: 32px; }
.btn-load-more {
  padding: 12px 32px;
  background: var(--bg-card);
  border: 1px solid var(--line-h);
  border-radius: 12px;
  font-weight: 600; font-size: .9rem;
  color: var(--ink-soft);
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease-bounce);
}
.btn-load-more:hover {
  background: var(--bg-card-h); color: var(--ink);
  border-color: rgba(0,200,255,0.3);
  transform: translateY(-2px);
}

/* =============================================================
   11. About Section
   ============================================================= */
.about { padding-block: 80px; border-top: 1px solid var(--line); }

.about-grid {
  display: grid; gap: 48px;
}
@media (min-width: 960px) {
  .about-grid { grid-template-columns: 1fr 1.3fr; align-items: start; }
}

.section-kicker {
  display: inline-block;
  font-family: var(--mono); font-size: .72rem;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 16px;
}

.about-text h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin-bottom: 16px;
}
.about-text h2 em {
  font-style: italic;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.about-text p { color: var(--ink-soft); max-width: 420px; }

.about-features {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  transition: border-color .2s, background .2s;
}
.feature-card:hover { border-color: var(--line-h); background: var(--bg-card-h); }
.feat-icon { font-size: 1.5rem; margin-bottom: 10px; }
.feature-card h3 { font-size: .95rem; margin-bottom: 6px; }
.feature-card p { font-size: .82rem; color: var(--ink-soft); }

/* =============================================================
   12. Footer
   ============================================================= */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 40px;
}
.footer .container {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center;
}
.footer-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1rem;
}
.footer-note { font-size: .8rem; color: var(--ink-mute); }
.footer-note a { color: var(--accent); text-decoration: underline; }
.footer-copy { font-size: .75rem; color: var(--ink-mute); }

/* =============================================================
   13. Modal
   ============================================================= */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 720px) {
  .modal { align-items: center; }
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 6, 14, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in .25s var(--ease-out);
}

.modal-inner {
  position: relative; z-index: 1;
  background: #0c1322;
  border: 1px solid rgba(0,200,255,0.15);
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 780px;
  max-height: 92vh;
  overflow-y: auto; overflow-x: hidden;
  padding: 28px clamp(16px,4vw,36px) 40px;
  animation: slide-up .35s var(--ease-out);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
@media (min-width: 720px) {
  .modal-inner { border-radius: 20px; animation: zoom-in .3s var(--ease-out); }
}

.modal.is-opening .modal-inner { animation: none; }
.modal.is-closing .modal-inner { animation: slide-down .3s var(--ease-soft); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-down { to { transform: translateY(40px); opacity: 0; } }
@keyframes zoom-in { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  color: var(--ink-soft);
  transition: background .2s, color .2s;
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: var(--ink); }

.modal-header {
  display: flex; align-items: flex-start; gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-right: 44px;
}
.modal-logo { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }
.modal-title-block { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.modal-coin-name { font-size: 1.4rem; font-weight: 800; }
.modal-coin-symbol { font-family: var(--mono); font-size: .8rem; color: var(--ink-mute); text-transform: uppercase; }

.modal-price-block { text-align: right; margin-left: auto; }
.modal-price {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1;
}
.modal-price.flash-up { animation: flash-green .7s; }
.modal-price.flash-down { animation: flash-red .7s; }
.modal-change {
  font-family: var(--mono); font-size: .9rem; font-weight: 600;
  margin-top: 4px;
}
.modal-change.pos { color: var(--gain); }
.modal-change.neg { color: var(--loss); }

.modal-refresh-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; color: var(--ink-mute);
  font-family: var(--mono); margin-top: 8px;
}
.refresh-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gain);
  animation: pulse-dot 2s infinite;
}
.modal-refresh-time {
  font-family: var(--mono); font-size: .67rem; color: var(--ink-mute);
  margin-top: 2px;
}

/* Stats grid */
.modal-stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 28px;
}
@media (min-width: 540px) { .modal-stats-grid { grid-template-columns: repeat(4, 1fr); } }

.modal-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 10px; padding: 12px;
}
.ms-label { display: block; font-family: var(--mono); font-size: .67rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute); margin-bottom: 6px; }
.ms-value { font-family: var(--mono); font-size: .88rem; font-weight: 600; }
.ms-value.nd { color: var(--ink-mute); font-weight: 400; font-style: italic; font-size: .78rem; }

.modal-loading { padding: 24px; text-align: center; color: var(--ink-mute); font-size: .85rem; }
.modal-error { padding: 24px; text-align: center; color: var(--loss); font-size: .85rem; }

/* Chart */
.modal-chart-section { margin-bottom: 28px; }

.chart-tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.chart-tab {
  padding: 6px 14px;
  border-radius: 7px; font-family: var(--mono); font-size: .78rem; font-weight: 500;
  color: var(--ink-mute); border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.chart-tab:hover { background: var(--bg-card-h); color: var(--ink); }
.chart-tab.active { background: rgba(0,200,255,0.1); border-color: rgba(0,200,255,0.3); color: var(--accent); }

.modal-chart-wrap {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; width: 100%;
}
.modal-chart-wrap canvas { display: block; width: 100%; }

/* Chart tooltip */
.chart-tooltip {
  position: fixed; z-index: 999; pointer-events: none;
  background: rgba(12,19,34,0.95);
  border: 1px solid rgba(0,200,255,0.25);
  border-radius: 8px; padding: 8px 12px;
  backdrop-filter: blur(10px);
}
.ct-price { font-family: var(--mono); font-size: .85rem; font-weight: 700; color: var(--ink); }
.ct-date { font-family: var(--mono); font-size: .72rem; color: var(--ink-mute); margin-top: 2px; }

/* Description */
.modal-description { margin-top: 8px; }
.modal-description h3 { font-size: .95rem; margin-bottom: 8px; color: var(--ink-soft); }
.modal-description p { font-size: .85rem; color: var(--ink-mute); line-height: 1.7; }

/* =============================================================
   14. AI Chat Widget
   ============================================================= */
.ai-chat {
  position: fixed; bottom: 24px; right: 24px; z-index: 150;
}

.ai-chat-toggle {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 24px rgba(0,200,255,0.35);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: transform .25s var(--ease-bounce), box-shadow .25s;
}
.ai-chat-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 32px rgba(0,200,255,0.5); }
.ai-badge {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--gain); color: var(--bg);
  font-size: .62rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}

.ai-chat-panel {
  position: absolute; bottom: 68px; right: 0;
  width: clamp(300px, 90vw, 380px);
  background: #0c1322;
  border: 1px solid rgba(0,200,255,0.18);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: chat-slide-up .3s var(--ease-out);
}
.ai-chat-panel[hidden] { display: none; }

@keyframes chat-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.ai-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,200,255,0.04);
}
.ai-header-info { display: flex; align-items: center; gap: 10px; }
.ai-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gain); animation: pulse-dot 2s infinite; }
.ai-chat-header strong { font-weight: 700; font-size: .9rem; display: block; }
.ai-subtitle { font-size: .72rem; color: var(--ink-mute); }
.ai-chat-close { color: var(--ink-soft); padding: 4px; border-radius: 6px; transition: color .2s; }
.ai-chat-close:hover { color: var(--ink); }

/* Setup screen */
.ai-setup {
  padding: 24px 20px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 12px;
}
.ai-setup-icon { font-size: 2rem; }
.ai-setup h3 { font-size: 1rem; font-weight: 700; }
.ai-setup p { font-size: .82rem; color: var(--ink-soft); }
.btn-get-key {
  display: inline-block; padding: 8px 18px;
  background: rgba(0,200,255,0.1);
  border: 1px solid rgba(0,200,255,0.3);
  border-radius: 8px; font-size: .82rem; font-weight: 600; color: var(--accent);
  transition: background .2s;
}
.btn-get-key:hover { background: rgba(0,200,255,0.2); }
.ai-key-input-wrap { display: flex; gap: 8px; width: 100%; }
.ai-key-input-wrap input {
  flex: 1; background: rgba(255,255,255,0.04); border: 1px solid var(--line-h);
  border-radius: 8px; padding: 8px 12px;
  font-size: .82rem; outline: 0;
  transition: border-color .2s;
}
.ai-key-input-wrap input:focus { border-color: rgba(0,200,255,0.4); }
.btn-save-key {
  padding: 8px 14px;
  background: var(--accent); color: var(--bg);
  border-radius: 8px; font-weight: 700; font-size: .82rem;
  transition: opacity .2s;
}
.btn-save-key:hover { opacity: .85; }
.ai-key-note { font-size: .7rem; color: var(--ink-mute); }

/* Chat area */
.ai-chat-area { display: flex; flex-direction: column; }
.ai-messages {
  height: 260px; overflow-y: auto; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.07) transparent;
}
.ai-msg {
  max-width: 86%; padding: 10px 13px;
  border-radius: 14px; font-size: .84rem; line-height: 1.55; white-space: pre-wrap;
}
.ai-msg-user {
  align-self: flex-end;
  background: rgba(0,200,255,0.15); border: 1px solid rgba(0,200,255,0.25);
  border-radius: 14px 14px 3px 14px;
}
.ai-msg-assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  border-radius: 14px 14px 14px 3px;
}

/* Typing dots */
.ai-typing {
  display: flex; gap: 5px; align-items: center;
  padding: 12px 16px;
}
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-mute);
  animation: typing-bounce .8s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .15s; }
.ai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.ai-input-row {
  display: flex; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
#ai-input {
  flex: 1; background: rgba(255,255,255,0.04);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; font-size: .85rem; outline: 0;
  transition: border-color .2s;
}
#ai-input:focus { border-color: rgba(0,200,255,0.35); }
.ai-send {
  width: 36px; height: 36px;
  background: var(--accent); color: var(--bg);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity .2s, transform .2s var(--ease-bounce);
}
.ai-send:hover { opacity: .85; transform: scale(1.05); }

.ai-clear-btn {
  font-size: .72rem; color: var(--ink-mute);
  padding: 4px 16px 10px;
  text-align: center; transition: color .2s;
}
.ai-clear-btn:hover { color: var(--loss); }

/* =============================================================
   15. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .modal-header { flex-wrap: nowrap; }
}

/* Ocultar columnas extra de la tabla en móvil — el grid es de 4 columnas */
@media (max-width: 959px) {
  .cr-mcap, .cr-vol, .cr-spark { display: none; }
  .cr-mcap-inline { display: none; }
}

@media (max-width: 539px) {
  /* Hero: reducir tamaño de título y evitar desbordamiento */
  .hero-title { font-size: 1.9rem; letter-spacing: -0.02em; }
  .hero-glow { display: none; }
  .hero-content { padding-inline: 16px; }

  .filters { flex-direction: column; align-items: stretch; }
  .filter-right { margin-left: 0; }
  .search-bar input { width: 100%; }
  .about-features { grid-template-columns: 1fr; }
  .modal-stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Chart tabs: caben las 6 en una línea reduciendo padding */
  .chart-tab { padding: 5px 8px; font-size: .7rem; }

  /* AI panel: posición fija relativa a la pantalla, no al botón */
  .ai-chat-panel {
    position: fixed;
    bottom: 90px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }

  /* Modal price no desborda en nombres largos */
  .modal-price { font-size: 1.2rem; }
  .modal-coin-name { font-size: 1.15rem; }
}

/* =============================================================
   16. Reduced-motion (intrusive effects only)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .ticker { animation: none; }
  .kicker-dot { animation: none; }
  .refresh-dot { animation: none; }
  .ai-status-dot { animation: none; }
  .ai-typing span { animation: none; }
  .sk { animation: none; }
}

/* =============================================================
   17. Cookie consent modal (blocking)
   ============================================================= */
.cookie-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6,9,20,.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cookie-overlay[hidden] { display: none; }

.cookie-modal {
  background: #0d1526;
  border: 1px solid rgba(99,179,237,.25);
  border-radius: 16px;
  padding: 36px 28px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.7);
  animation: popIn .25s ease;
}
@keyframes popIn {
  from { transform: scale(.93); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}
.cookie-modal.shake { animation: shake .4s ease; }

.cookie-icon { font-size: 2.4rem; margin-bottom: 12px; }
.cookie-modal h2 {
  font-size: 1.2rem; font-weight: 700;
  color: var(--ink); margin-bottom: 10px;
}
.cookie-modal p {
  font-size: .85rem; color: var(--ink-mute);
  line-height: 1.65; margin-bottom: 8px;
}
.cookie-policy-link { color: var(--accent) !important; }

.cookie-actions {
  display: flex; flex-direction: column;
  gap: 10px; margin-top: 20px;
}
.btn-cookie-accept {
  background: var(--accent);
  color: #000;
  border: none; border-radius: 8px;
  padding: 11px 20px; font-size: .9rem; font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-cookie-accept:hover { opacity: .85; }
.btn-cookie-reject {
  background: transparent;
  color: var(--ink-mute);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 9px 20px; font-size: .85rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-cookie-reject:hover { border-color: var(--ink-mute); color: var(--ink); }
.cookie-reject-msg {
  font-size: .8rem; color: #fc8181;
  margin-top: 12px; margin-bottom: 0;
}
.cookie-reject-msg[hidden] { display: none; }

/* =============================================================
   18. Language switcher
   ============================================================= */
.lang-switcher { position: relative; flex-shrink: 0; }
.lang-btn {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: .78rem; font-weight: 600; color: var(--ink);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.lang-btn:hover { background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.2); }
.lang-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #0c1423;
  border: 1px solid rgba(99,179,237,.2);
  border-radius: 10px;
  min-width: 170px;
  padding: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  list-style: none; margin: 0;
  z-index: 500;
}
.lang-dropdown[hidden] { display: none; }
.lang-option {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px;
  font-size: .83rem; color: var(--ink-mute);
  cursor: pointer; list-style: none;
  transition: background .12s, color .12s;
}
.lang-option:hover { background: rgba(255,255,255,.07); color: var(--ink); }
.lang-option.active { color: var(--accent); font-weight: 600; }
.lang-option .rpm-badge {
  margin-left: auto; font-size: .68rem; color: #f6ad55;
  font-weight: 500; white-space: nowrap;
}

/* =============================================================
   19. Legal / Privacy page
   ============================================================= */
.legal-page {
  padding-top: 100px;
  padding-bottom: 80px;
  min-height: 80vh;
}
.legal-content {
  max-width: 740px;
  margin: 0 auto;
}
.legal-content h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: .3rem;
}
.legal-date {
  font-size: .82rem;
  color: var(--ink-mute);
  margin-bottom: 2.5rem;
  font-family: var(--mono);
}
.legal-content h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 2rem 0 .6rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.legal-content p {
  font-size: .9rem;
  color: var(--ink-mute);
  line-height: 1.75;
  margin-bottom: .9rem;
}
.legal-content ul {
  padding-left: 1.4rem;
  margin-bottom: .9rem;
}
.legal-content li {
  font-size: .9rem;
  color: var(--ink-mute);
  line-height: 1.7;
  margin-bottom: .4rem;
}
.legal-content a { color: var(--accent); }
.legal-content code {
  font-family: var(--mono);
  font-size: .8rem;
  background: rgba(255,255,255,.06);
  padding: 1px 5px;
  border-radius: 3px;
}
