:root,
[data-theme="dark"] {
  --bg: #0a0e17;
  --bg-elevated: #0d1220;
  --surface: #131a29;
  --surface-alt: #1b2436;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text-primary: #e9edf5;
  --text-secondary: #9aa4b9;
  --text-muted: #626d83;

  --accent-gold: #f0b90b;
  --accent-gold-dim: rgba(240, 185, 11, 0.12);
  --accent-cyan: #35d0c2;
  --up: #17c993;
  --up-dim: rgba(23, 201, 147, 0.12);
  --down: #f0475f;
  --down-dim: rgba(240, 71, 95, 0.12);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.45), 0 16px 40px rgba(0, 0, 0, 0.38);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-alt: #eef1f7;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);

  --text-primary: #101728;
  --text-secondary: #4b5468;
  --text-muted: #7c869b;

  --accent-gold: #b8860b;
  --accent-gold-dim: rgba(184, 134, 11, 0.1);
  --accent-cyan: #0f9e90;
  --up: #0da572;
  --up-dim: rgba(13, 165, 114, 0.1);
  --down: #d92e46;
  --down-dim: rgba(217, 46, 70, 0.1);

  --shadow-card: 0 1px 2px rgba(16, 23, 42, 0.06), 0 8px 20px rgba(16, 23, 42, 0.06);
  --shadow-card-hover: 0 2px 6px rgba(16, 23, 42, 0.08), 0 16px 32px rgba(16, 23, 42, 0.1);

  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  transition: background 0.25s ease, color 0.25s ease;
  min-height: 100vh;
}

.font-display { font-family: 'Space Grotesk', 'Inter', sans-serif; }
.font-mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

a { text-decoration: none; }

::selection { background: var(--accent-gold-dim); color: var(--text-primary); }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ERROR */

.error-page{
  min-height: calc(100vh - 140px);
  display:flex;
  justify-content:center;
  align-items:center;
  padding:2rem;
}

.error-card{
  max-width:600px;
  width:100%;
  text-align:center;
  padding:3rem;
  border-radius:20px;
  background:var(--card-bg);
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 20px 40px rgba(0,0,0,.2);
}

.error-icon{
  font-size:4rem;
  color:#f59e0b;
  margin-bottom:1rem;
}

.error-card h1{
  margin-bottom:1rem;
}

.error-card p{
  margin-bottom:2rem;
  opacity:.8;
}

/*NAVBAR*/

.navbar-crypto {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(10, 14, 23, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s ease, border-color 0.25s ease;
}
[data-theme="light"] .navbar-crypto {
  background: rgba(244, 246, 250, 0.86);
}
.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.brand-mark .bi, .brand-mark-bi {
  color: var(--accent-cyan);
  font-size: 1.5rem;
}
.brand-mark span.dash-part { color: var(--accent-cyan); }

.nav-search {
  position: relative;
  width: 100%;
  max-width: 420px;
}
.nav-search input {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 0.55rem 0.9rem 0.55rem 2.4rem;
  font-size: 0.9rem;
  width: 100%;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.nav-search input::placeholder { color: var(--text-muted); }
.nav-search input:focus {
  border-color: var(--accent-gold);
  background: var(--surface);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-gold-dim);
}
.nav-search .bi-search {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.nav-search kbd {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.theme-toggle-btn:hover {
  border-color: var(--accent-gold);
  transform: translateY(-1px);
}
.theme-toggle-btn .bi-moon-stars-fill { color: var(--accent-gold); }
.theme-toggle-btn .bi-sun-fill { color: var(--accent-gold); }

.navbar-toggler-crypto {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-primary);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-link-crypto {
  color: var(--text-secondary) !important;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.5rem 0.85rem !important;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}
.nav-link-crypto:hover,
.nav-link-crypto.active {
  color: var(--text-primary) !important;
  background: var(--surface-alt);
}

/* TICKER TAPE — signature element */

.ticker-wrap {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  white-space: nowrap;
  padding: 0.55rem 0;
}
.ticker-wrap::before,
.ticker-wrap::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 60px;
  z-index: 2;
  pointer-events: none;
}
.ticker-wrap::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg-elevated), transparent);
}
.ticker-wrap::after {
  right: 0;
  background: linear-gradient(270deg, var(--bg-elevated), transparent);
}
.ticker-track {
  display: inline-flex;
  align-items: center;
  animation: ticker-scroll 45s linear infinite;
  will-change: transform;
}
.ticker-wrap:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 1.4rem;
  font-size: 0.83rem;
  border-right: 1px solid var(--border);
}
.ticker-item .t-symbol { color: var(--text-primary); font-weight: 600; }
.ticker-item .t-price { color: var(--text-secondary); }
.ticker-item .t-change.up { color: var(--up); }
.ticker-item .t-change.down { color: var(--down); }

/* HERO */

.hero-section {
  padding: 3.5rem 0 3rem;
  background:
    radial-gradient(ellipse 900px 400px at 15% -10%, rgba(240, 185, 11, 0.08), transparent 60%),
    radial-gradient(ellipse 700px 400px at 100% 0%, rgba(53, 208, 194, 0.06), transparent 60%);
}

.sentiment-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--up-dim);
  color: var(--up);
  border: 1px solid rgba(23, 201, 147, 0.25);
  padding: 0.4rem 0.9rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.sentiment-badge.bearish {
  background: var(--down-dim);
  color: var(--down);
  border-color: rgba(240, 71, 95, 0.25);
}
.sentiment-badge .pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(23, 201, 147, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(23, 201, 147, 0); }
  100% { box-shadow: 0 0 0 0 rgba(23, 201, 147, 0); }
}

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(1.9rem, 3.5vw, 2.7rem);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 560px;
}

/* Stat cards */

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  height: 100%;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-gold-dim), transparent 55%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
}
.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  font-size: 1.05rem;
  margin-bottom: 0.9rem;
}
.stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.55rem;
  color: var(--text-primary);
  line-height: 1.2;
  position: relative;
  z-index: 1;
}
.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.83rem;
  font-weight: 600;
  margin-top: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
}
.stat-change.up { color: var(--up); }
.stat-change.down { color: var(--down); }
.stat-change .label-vs {
  color: var(--text-muted);
  font-weight: 400;
  font-family: 'Inter', sans-serif;
  margin-left: 0.15rem;
}

/* FEATURED COINS — card grid */
    .featured-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 1.25rem 1.3rem;
      height: 100%;
      box-shadow: var(--shadow-card);
      transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    }
    .featured-card:hover {
      transform: translateY(-4px);
      box-shadow: var(--shadow-card-hover);
      border-color: var(--border-strong);
    }

    .featured-card-top {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      margin-bottom: 0.9rem;
    }
    .featured-coin-id {
      display: flex;
      align-items: center;
      gap: 0.65rem;
    }
    .featured-coin-id img {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: var(--surface-alt);
      object-fit: cover;
    }
    .featured-coin-name {
      font-weight: 600;
      font-size: 0.95rem;
      color: var(--text-primary);
      line-height: 1.2;
    }
    .featured-coin-symbol {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.75rem;
      color: var(--text-muted);
      text-transform: uppercase;
    }

    .favourite-star {
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 1.15rem;
      line-height: 1;
      padding: 0.15rem;
      transition: color 0.15s ease, transform 0.15s ease;
    }
    .favourite-star:hover { color: var(--accent-gold); transform: scale(1.12); }
    .favourite-star.active,
    .watch-btn.active { color: var(--accent-gold); }

    .featured-price-row {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      margin-bottom: 0.85rem;
    }
    .featured-price {
      font-family: 'JetBrains Mono', monospace;
      font-weight: 600;
      font-size: 1.25rem;
      color: var(--text-primary);
    }
    .featured-change {
      font-family: 'JetBrains Mono', monospace;
      font-weight: 600;
      font-size: 0.82rem;
      display: inline-flex;
      align-items: center;
      gap: 0.2rem;
      padding: 0.2rem 0.5rem;
      border-radius: 100px;
    }
    .featured-change.up { color: var(--up); background: var(--up-dim); }
    .featured-change.down { color: var(--down); background: var(--down-dim); }

    /* Sparkline  */
    .sparkline-placeholder {
      width: 100%;
      height: 44px;
      display: block;
      overflow: visible;
    }
    .sparkline-placeholder path.spark-line {
      fill: none;
      stroke-width: 1.75;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .sparkline-placeholder path.spark-fill {
      stroke: none;
      opacity: 0.12;
    }
    .sparkline-placeholder.up path.spark-line,
    .sparkline-placeholder.up path.spark-fill { stroke: var(--up); fill: var(--up); }
    .sparkline-placeholder.down path.spark-line,
    .sparkline-placeholder.down path.spark-fill { stroke: var(--down); fill: var(--down); }

/* MARKET TABLE */

.section-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.market-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.table-crypto {
  margin-bottom: 0;
  color: var(--text-primary);
}
.table-crypto thead th {
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1rem;
  white-space: nowrap;
}
.table-crypto tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.table-crypto tbody tr:last-child td { border-bottom: none; }
.table-crypto tbody tr {
  transition: background 0.15s ease;
}
.table-crypto tbody tr:hover {
  background: var(--surface-alt);
}

.coin-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.coin-cell img {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface-alt);
  object-fit: cover;
}
.coin-name { font-weight: 600; color: var(--text-primary); }
.coin-symbol { color: var(--text-muted); font-size: 0.78rem; font-family: 'JetBrains Mono', monospace; }

.change-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.83rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.change-pill.up { color: var(--up); }
.change-pill.down { color: var(--down); }

.rank-num { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

.watch-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.05rem;
  transition: color 0.15s ease, transform 0.15s ease;
}
.watch-btn:hover { color: var(--accent-gold); transform: scale(1.1); }

/* TOP GAINERS / TOP LOSERS */

.movers-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 16px;
padding: 1.4rem 1.4rem 0.5rem;
height: 100%;
box-shadow: var(--shadow-card);
}
.movers-card .section-heading {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.1rem;
}
.movers-card .section-heading i.up { color: var(--up); }
.movers-card .section-heading i.down { color: var(--down); }

.mover-row {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.7rem 0.25rem;
border-bottom: 1px solid var(--border);
transition: background 0.15s ease;
border-radius: 8px;
}
.mover-row:last-child { border-bottom: none; }
.mover-row:hover { background: var(--surface-alt); }

.mover-rank {
width: 20px;
flex-shrink: 0;
color: var(--text-muted);
font-family: 'JetBrains Mono', monospace;
font-size: 0.78rem;
}
.mover-row img {
width: 30px;
height: 30px;
border-radius: 50%;
background: var(--surface-alt);
object-fit: cover;
flex-shrink: 0;
}
.mover-name-wrap { flex: 1 1 auto; min-width: 0; }
.mover-name {
font-weight: 600;
font-size: 0.9rem;
color: var(--text-primary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.mover-symbol {
font-size: 0.75rem;
color: var(--text-muted);
font-family: 'JetBrains Mono', monospace;
text-transform: uppercase;
}
.mover-price {
font-family: 'JetBrains Mono', monospace;
font-size: 0.88rem;
color: var(--text-primary);
text-align: right;
flex-shrink: 0;
min-width: 84px;
}
.mover-change {
font-family: 'JetBrains Mono', monospace;
font-weight: 600;
font-size: 0.82rem;
text-align: right;
flex-shrink: 0;
min-width: 68px;
display: inline-flex;
align-items: center;
justify-content: flex-end;
gap: 0.2rem;
}
.mover-change.up { color: var(--up); }
.mover-change.down { color: var(--down); }

/* PRICE CHART */
.chart-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 16px;
padding: 1.4rem;
box-shadow: var(--shadow-card);
}
.chart-coin-id img {
width: 36px;
height: 36px;
border-radius: 50%;
background: var(--surface-alt);
object-fit: cover;
}
.chart-coin-price {
font-family: 'JetBrains Mono', monospace;
font-size: 1.4rem;
font-weight: 600;
color: var(--text-primary);
}

.time-range-group {
background: var(--surface-alt);
border: 1px solid var(--border);
border-radius: 10px;
padding: 0.25rem;
gap: 0.15rem;
}
.time-range-btn {
background: transparent;
border: none;
color: var(--text-secondary);
font-family: 'JetBrains Mono', monospace;
font-size: 0.78rem;
font-weight: 600;
padding: 0.35rem 0.75rem;
border-radius: 7px;
transition: background 0.15s ease, color 0.15s ease;
}
.time-range-btn:hover { color: var(--text-primary); }
.time-range-btn.active {
background: var(--accent-gold);
color: #0a0e17;
}

/* Chart placeholder: static illustrative SVG. */
.chart-placeholder-wrap {
position: relative;
width: 100%;
margin-top: 1.25rem;
}
.chart-placeholder-wrap svg { width: 100%; height: auto; display: block; }
.chart-grid-line {
stroke: var(--border);
stroke-width: 1;
}
.chart-line-path {
fill: none;
stroke: var(--accent-gold);
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
.chart-fill-path {
stroke: none;
fill: url(#chartGradient);
}

/* FOOTER */

footer.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1.75rem 0;
}

.back-to-top-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.back-to-top-btn:hover { border-color: var(--accent-gold); transform: translateY(-2px); color: var(--text-primary); }


@media (max-width: 767.98px) {
  .hero-section { padding: 2rem 0 1.75rem; }
  .stat-value { font-size: 1.3rem; }
}