:root {
  --bg: #0c0f1d;
  --bg-2: #11152a;
  --card: #181d36;
  --card-hover: #20264a;
  --line: #2a3158;
  --text: #edf0ff;
  --muted: #97a0c8;
  --accent: #ffcb05;
  --accent-2: #3d7dca;
  --up: #3ddc84;
  --down: #ff5d5d;
  --radius: 14px;
}

.theme-op {
  --accent: #e63946;
  --accent-2: #f4a261;
}

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

html {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  position: relative;
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent-2); }

img,
svg,
canvas {
  max-width: 100%;
}

/* ---------- News ticker ---------- */
.ticker-wrap {
  overflow: hidden;
  max-width: 100%;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  padding: 0.45rem 0;
}

.ticker {
  display: inline-block;
  white-space: nowrap;
  animation: ticker-scroll 60s linear infinite;
  will-change: transform;
  max-width: none;
}

.ticker-wrap:hover .ticker { animation-play-state: paused; }

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

.ticker-item {
  display: inline-block;
  margin-right: 3rem;
  font-size: 0.85rem;
  color: var(--text);
}

.ticker-item a { color: var(--text); text-decoration: none; }
.ticker-item a:hover { color: var(--accent); }

.ticker-source {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-right: 0.5rem;
  vertical-align: 1px;
}

.src-pokebeach { background: #2b6e3f; color: #fff; }
.src-tcgplayer { background: #1d4ed8; color: #fff; }
.src-pokemoncenter { background: #b91c1c; color: #fff; }
.src-news { background: #4b5563; color: #fff; }

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.9rem 1.5rem;
  max-width: 100%;
  background: rgba(12, 15, 29, 0.93);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--accent);
  text-decoration: none;
  flex: 0 0 auto;
}

.logo-icon { width: 27px; height: 27px; }

.logo span { color: var(--accent-2); }

.nav {
  display: flex;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar { display: none; }

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  flex: 0 0 auto;
  white-space: nowrap;
}

.nav a:hover { color: var(--text); background: var(--card); }
.nav a.active { color: var(--text); background: var(--card); border: 1px solid var(--line); }

/* ---------- Layout ---------- */
main {
  width: 100%;
  max-width: 1150px;
  margin: 0 auto;
  padding: 1.5rem;
  overflow: hidden;
  contain: inline-size;
}

.hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.hero h1 { margin: 0 0 0.5rem; font-size: clamp(1.5rem, 4vw, 2.2rem); }
.hero p { color: var(--muted); max-width: 640px; margin: 0.25rem auto; }

.freshness { color: var(--muted); font-size: 0.8rem; }

.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.25rem 0;
  max-width: 100%;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.panel h2 { margin: 0; font-size: 1.15rem; }
.panel-sub { color: var(--muted); font-size: 0.85rem; margin: 0.4rem 0 0.9rem; }
.more { font-size: 0.85rem; text-decoration: none; font-weight: 600; }

.badge {
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

/* ---------- Featured row ---------- */
.row-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: 0.9rem;
  overflow-x: auto;
  max-width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.mini-card {
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.6rem;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.mini-card:hover { border-color: var(--accent-2); background: var(--card-hover); transform: translateY(-2px); }
.mini-card img { width: 100%; border-radius: 6px; aspect-ratio: 0.717; object-fit: contain; background: #0a0d18; }
.mini-card .name {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0.4rem 0 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-card .price { font-size: 0.85rem; color: var(--accent); font-weight: 700; }

/* ---------- Movers ---------- */
.movers { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.75rem; }

.mover {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--card);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  border: 1px solid transparent;
  min-width: 0;
  max-width: 100%;
}

.mover:hover { border-color: var(--accent-2); }
.mover img { width: 38px; max-width: 38px; flex: 0 0 auto; border-radius: 4px; }
.mover .m-name { font-size: 0.85rem; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover .m-name small { display: block; color: var(--muted); font-weight: 400; }
.delta { font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.75rem; max-width: 100%; }

.toolbar input,
.toolbar select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  outline: none;
  max-width: 100%;
  min-width: 0;
}

.toolbar input { flex: 1 1 220px; min-width: 0; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent-2); }

.status { color: var(--muted); text-align: center; min-height: 1.2em; }

/* ---------- Card grid ---------- */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: 1rem;
  max-width: 100%;
}

.tcard {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.75rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.tcard:hover { transform: translateY(-3px); border-color: var(--accent-2); background: var(--card-hover); }
.tcard img { width: 100%; border-radius: 8px; aspect-ratio: 0.717; object-fit: contain; background: #0a0d18; }
.tcard .name { font-weight: 600; font-size: 0.9rem; margin: 0.5rem 0 0.1rem; }
.tcard .meta { color: var(--muted); font-size: 0.75rem; }
.tcard .pricebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  gap: 0.5rem;
  min-width: 0;
}
.tcard .price { color: var(--accent); font-weight: 700; }
.tcard .rarity {
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rarity-glow-common { box-shadow: inset 0 0 0 1px rgba(151, 160, 200, 0.08), 0 0 18px rgba(151, 160, 200, 0.1); }
.rarity-glow-uncommon { box-shadow: inset 0 0 0 1px rgba(61, 220, 132, 0.12), 0 0 20px rgba(61, 220, 132, 0.16); }
.rarity-glow-rare { box-shadow: inset 0 0 0 1px rgba(61, 125, 202, 0.18), 0 0 24px rgba(61, 125, 202, 0.2); }
.rarity-glow-holo { box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.24), 0 0 28px rgba(124, 92, 255, 0.26); }
.rarity-glow-ultra { box-shadow: inset 0 0 0 1px rgba(255, 203, 5, 0.24), 0 0 34px rgba(255, 203, 5, 0.28); }
.rarity-glow-secret,
.rarity-glow-manga,
.rarity-glow-special { box-shadow: inset 0 0 0 1px rgba(255, 105, 180, 0.28), 0 0 38px rgba(255, 105, 180, 0.26), 0 0 56px rgba(255, 203, 5, 0.14); }
.rarity-glow-leader,
.rarity-glow-super { box-shadow: inset 0 0 0 1px rgba(244, 162, 97, 0.26), 0 0 34px rgba(244, 162, 97, 0.28); }

.load-more {
  display: block;
  margin: 1.75rem auto;
  background: var(--accent-2);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 2rem;
  font-size: 1rem;
  cursor: pointer;
}
.load-more:hover { filter: brightness(1.15); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
  max-width: 100%;
  overflow: hidden;
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: min(940px, 96%);
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem;
  position: relative;
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1.75rem;
  max-width: 100%;
}

@media (max-width: 640px) { .modal { grid-template-columns: 1fr; padding: 1rem; gap: 1rem; } }
@media (max-width: 640px) { .modal-card-col { position: static; } }

.modal .close {
  position: absolute;
  top: 0.4rem;
  right: 0.7rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.7rem;
  cursor: pointer;
}

.modal img.art { width: 100%; border-radius: 10px; }
.modal h2 { margin: 0 0 0.2rem; font-size: 1.25rem; }
.modal .meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.75rem; }

.price-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 0.5rem 0; }
.price-table th, .price-table td { text-align: right; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); }
.price-table th:first-child, .price-table td:first-child { text-align: left; }
.price-table th { color: var(--muted); font-weight: 600; }
.price-table .mkt { color: var(--accent); font-weight: 700; }

.trend-row { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0.5rem 0; font-size: 0.85rem; }
.trend-row .t { color: var(--muted); }
.trend-row .t b { color: var(--text); display: block; font-size: 0.95rem; }

.buy-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.9rem; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.55rem; margin: 0.8rem 0; }
.detail-stat { background: rgba(24, 29, 54, 0.7); border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.65rem; min-width: 0; }
.detail-stat span { display: block; color: var(--muted); font-size: 0.72rem; margin-bottom: 0.15rem; }
.detail-stat b { display: block; color: var(--text); font-size: 0.9rem; overflow-wrap: anywhere; }
.card-text { color: var(--text); font-size: 0.86rem; line-height: 1.45; overflow-wrap: anywhere; }

.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
}

.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent-2); }

.note { color: var(--muted); font-size: 0.75rem; margin-top: 0.6rem; }

/* ---------- Sources / footer ---------- */
.sources ul { margin: 0.75rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.9rem; }
.sources li { margin: 0.45rem 0; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 2rem 1rem;
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}

/* ---------- Hero variants ---------- */
.hero.compact { padding: 0.75rem 0 0; }
.hero.compact h1 { font-size: clamp(1.3rem, 3vw, 1.7rem); }

.muted { color: var(--muted); }

/* ---------- Stat tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin: 1.1rem 0;
}

.tile {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.tile .t-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.tile .t-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0.25rem 0 0.1rem;
}

.tile .t-sub {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Charts ---------- */
.chart-wrap { position: relative; height: 320px; }
.chart-wrap.tall { height: 420px; }

/* ---------- Data tables ---------- */
.table-scroll { overflow-x: auto; }
.table-scroll {
  max-width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  min-width: 640px;
}

.data-table th, .data-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table .cell-card { display: flex; align-items: center; gap: 0.5rem; }
.data-table .cell-card img { width: 30px; border-radius: 3px; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; border-radius: 8px; }

/* ---------- Filter chips ---------- */
.chip {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.chip:hover { color: var(--text); border-color: var(--accent-2); }
.chip.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

/* ---------- News grid ---------- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.news-card {
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
  min-width: 0;
  overflow: hidden;
}

.news-card:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.news-card h3 { margin: 0.6rem 0 0; font-size: 0.95rem; line-height: 1.4; font-weight: 600; }
.news-meta { display: flex; justify-content: space-between; align-items: center; }
.news-time { color: var(--muted); font-size: 0.75rem; }

/* ---------- Sealed products ---------- */
.sealed-toolbar input { min-width: min(320px, 100%); }

.sealed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 1rem;
}

.sealed-card {
  appearance: none;
  width: 100%;
  min-width: 0;
  text-align: left;
  color: var(--text);
  background: var(--card);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.8rem;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.sealed-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-2);
  background: var(--card-hover);
}

.sealed-img-wrap {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #0a0d18;
  overflow: hidden;
  margin-bottom: 0.7rem;
}

.sealed-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sealed-name {
  display: block;
  font-weight: 750;
  line-height: 1.25;
  margin-bottom: 0.25rem;
}

.sealed-card .pricebar {
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sealed-card .rarity {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.7rem;
}

.sealed-art {
  background: #fff;
  object-fit: contain;
}

.no-img {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* ---------- Watchlist star ---------- */
.tcard, .mini-card { position: relative; }

.star {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  background: rgba(10, 13, 24, 0.75);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  width: 30px;
  height: 30px;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.star:hover { color: var(--accent); border-color: var(--accent); }
.star.on { color: var(--accent); border-color: var(--accent); }

.wl-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--card);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  margin: 0.4rem 0;
  min-width: 0;
  max-width: 100%;
}

.wl-row img { width: 34px; max-width: 34px; flex: 0 0 auto; border-radius: 4px; }
.wl-row .m-name { flex: 1; min-width: 0; font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-row .m-name small { display: block; color: var(--muted); font-weight: 400; }
.wl-row .price { color: var(--accent); font-weight: 700; font-size: 0.9rem; }
.wl-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.wl-remove:hover { color: var(--down); }

.sub-h { font-size: 0.95rem; margin: 1.25rem 0 0.5rem; }

/* ---------- Card history sparkline ---------- */
.card-history { margin-top: 0.75rem; color: var(--accent); }
.card-history .spark { width: 100%; height: 90px; display: block; }
.hist-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.hist-range {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

@media (prefers-reduced-motion: reduce) {
  .ticker,
  .ticker-item:first-child { animation: none; }
}

@media (max-width: 700px) {
  body > * {
    max-width: 100%;
  }

  .ticker-wrap {
    padding-inline: 1rem;
  }

  .ticker {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: none;
    transform: none;
    contain: inline-size;
  }

  .ticker-item {
    display: none;
    width: max-content;
    max-width: none;
    margin-right: 0;
    overflow: visible;
    text-overflow: clip;
  }

  .ticker-item:first-child {
    display: inline-block;
    padding-left: 100%;
    animation: mobile-ticker-scroll 18s linear infinite;
    will-change: transform;
  }

  .header {
    display: block;
    padding: 0.8rem max(0.9rem, env(safe-area-inset-right)) 0.75rem max(0.9rem, env(safe-area-inset-left));
    overflow: hidden;
    contain: inline-size;
  }

  .logo {
    margin-bottom: 0.65rem;
  }

  .nav {
    margin: 0 -0.15rem;
    padding-bottom: 0.2rem;
  }

  .nav a {
    padding: 0.45rem 0.78rem;
  }

  main {
    padding: 1rem;
  }

  .panel {
    padding: 1rem;
    margin: 1rem 0;
  }

  .movers {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .toolbar select,
  .toolbar .chip {
    width: 100%;
  }

  #news-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  #news-filters .chip {
    flex: 0 0 auto;
    width: auto;
  }

  .modal-overlay {
    align-items: flex-start;
    padding: 0.75rem;
  }

  .modal {
    max-width: 100%;
    max-height: calc(100dvh - 1.5rem);
    padding: 1rem;
  }

  .modal img.art {
    max-height: 55vh;
    object-fit: contain;
  }
}

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

@media (max-width: 430px) {
  .row-scroll {
    grid-auto-columns: minmax(132px, 42vw);
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .tcard {
    padding: 0.6rem;
  }

  .tcard .pricebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .news-meta {
    gap: 0.5rem;
  }
}

/* ---------- Alerts settings page ---------- */
.steps { color: var(--muted); font-size: 0.9rem; line-height: 1.6; padding-left: 1.1rem; margin: 0.5rem 0 1rem; }
.steps code, .panel-sub code, .config-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.05rem 0.35rem; font-size: 0.85em;
}
.form-grid { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.5rem; }
.form-grid input {
  flex: 1; min-width: 200px; box-sizing: border-box;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0.6rem 0.85rem; font-size: 0.95rem; outline: none;
}
.form-grid input:focus { border-color: var(--accent-2); }

.alert-opt { padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.alert-opt:last-child { border-bottom: none; }
.switch { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1rem; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent-2); }

.inline-num {
  width: 64px; box-sizing: border-box;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0.2rem 0.4rem; font-size: 0.9rem; text-align: center;
}

.watch-trigger {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  background: var(--card); border-radius: 10px; padding: 0.5rem 0.75rem; margin: 0.45rem 0;
}
.watch-trigger img { width: 34px; border-radius: 4px; }
.watch-trigger .wt-name { flex: 1; min-width: 130px; font-size: 0.85rem; font-weight: 600; }
.watch-trigger .wt-name small { display: block; color: var(--muted); font-weight: 400; }
.watch-trigger label { color: var(--muted); font-size: 0.78rem; display: inline-flex; align-items: center; gap: 0.3rem; }

.config-box {
  display: block; white-space: pre; overflow-x: auto;
  padding: 0.9rem 1rem; margin: 0.6rem 0; font-size: 0.8rem;
  color: var(--text); max-width: 100%;
}

/* ========================================================
   POKÉMON PAGE ENHANCEMENTS
   ======================================================== */

/* ---------- Skeleton loader ---------- */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.sk { pointer-events: none !important; cursor: default !important; }
.sk-img, .sk-line, .sk-pill {
  border-radius: 6px;
  background: linear-gradient(90deg, #1a2040 0%, #252c52 50%, #1a2040 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
.sk-img  { width: 100%; aspect-ratio: 0.717; border-radius: 8px; }
.sk-line { height: 11px; margin: 7px 0; }
.sk-w80  { width: 80%; }
.sk-w50  { width: 50%; }
.sk-pricebar { display: flex; gap: 6px; margin-top: 10px; }
.sk-pill { height: 20px; border-radius: 999px; }
.sk-w40 { width: 40%; }
.sk-w30 { width: 30%; }

/* ---------- Card entry animation ---------- */
@keyframes card-enter {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.card-enter {
  animation: card-enter 0.38s ease both;
  opacity: 0;
}

/* ---------- Hide empty badge ---------- */
.badge:empty { display: none; }

/* ---------- No TCGplayer price warning ---------- */
.no-prices-warn {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: rgba(61, 125, 202, 0.08);
  border: 1px solid rgba(61, 125, 202, 0.3);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.np-icon { font-size: 1.3rem; flex: 0 0 auto; margin-top: 1px; }

.no-prices-warn strong { color: var(--accent-2); }

.np-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.np-link:hover { color: var(--accent-2); }

/* ---------- Sparse data warning ---------- */
.sparse-warn {
  grid-column: 1 / -1;
  background: rgba(255, 203, 5, 0.08);
  border: 1px solid rgba(255, 203, 5, 0.3);
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font-size: 0.82rem;
  color: var(--accent);
  line-height: 1.45;
}

/* ---------- Tile entry animation ---------- */
@keyframes tile-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.tile-anim {
  animation: tile-enter 0.4s ease both;
}

/* ---------- Set overview ---------- */
#set-overview { margin: 0.5rem 0 0.25rem; }

.dist-panel {
  padding: 1rem 1.25rem 1.1rem;
  margin-top: 0.75rem;
}

.dist-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.6rem;
}

.dist-bars {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  height: 72px;
}

.dist-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  height: 100%;
  justify-content: flex-end;
}

.dist-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  min-height: 0;
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dist-count { font-size: 0.7rem; font-weight: 700; color: var(--text); }
.dist-tier  { font-size: 0.62rem; color: var(--muted); text-align: center; white-space: nowrap; }

/* ---------- Insights section ---------- */
#insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 1rem;
  margin: 0.75rem 0 1rem;
}

.insight-panel { margin: 0; }

.insights-scroll {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.insights-scroll::-webkit-scrollbar { height: 4px; }
.insights-scroll::-webkit-scrollbar-track { background: transparent; }
.insights-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

/* ---------- Insight card ---------- */
.insight-card {
  flex: 0 0 auto;
  width: 140px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.insight-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-2);
  box-shadow: 0 8px 28px rgba(61, 125, 202, 0.25);
}

.insight-card img {
  width: 100%;
  border-radius: 6px;
  aspect-ratio: 0.717;
  object-fit: contain;
  background: #0a0d18;
  display: block;
}

.ic-body { margin-top: 0.4rem; }

.ic-name {
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.1rem;
}

.ic-price {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.ic-sigs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* ---------- Signal badges ---------- */
.sig-badge {
  font-size: 0.58rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.1rem 0.32rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.sig-up      { background: rgba(61, 220, 132, 0.18); color: var(--up); }
.sig-down    { background: rgba(255, 93, 93, 0.18);  color: var(--down); }
.sig-accent  { background: rgba(255, 203, 5, 0.15);  color: var(--accent); }
.sig-accent-2 { background: rgba(61, 125, 202, 0.2); color: var(--accent-2); }

/* ---------- Modal enhancements ---------- */

/* Sticky left column — image stays in view while right side scrolls */
.modal-card-col {
  position: sticky;
  top: 0;
  align-self: start;
}

/* Prominent market price below the card image */
.modal-price-hero {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: rgba(24, 29, 54, 0.8);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.mph-label { display: block; color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 0.2rem; }
.mph-value { display: block; font-size: 1.75rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.mph-delta { display: block; font-size: 0.75rem; margin-top: 0.35rem; font-weight: 700; }
.mph-delta.up { color: var(--up); }
.mph-delta.down { color: var(--down); }

/* Action buttons in left column */
.modal-actions {
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.modal-btn-tcg {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(61, 125, 202, 0.15);
  border: 1px solid rgba(61, 125, 202, 0.35);
  color: var(--accent-2);
  transition: filter 0.15s;
}
.modal-btn-tcg:hover { filter: brightness(1.2); }

/* Copy name button next to card title */
.modal-title-row { display: flex; align-items: flex-start; gap: 0.3rem; flex-wrap: wrap; }
.modal-title-row h2 { margin: 0; flex: 1 1 auto; }
.copy-name-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.2rem 0.45rem;
  border-radius: 5px;
  margin-top: 0.2rem;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.copy-name-btn:hover { color: var(--accent-2); border-color: var(--accent-2); background: rgba(61,125,202,0.08); }

.modal-chart-wrap {
  margin-top: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.chart-loading {
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.5rem 0;
}

.spread-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.3rem 0;
  color: var(--muted);
}

.spread-val { color: var(--accent); font-weight: 700; }

.card-flavor {
  font-style: italic;
  color: var(--muted) !important;
}

@media (max-width: 700px) {
  #insights {
    grid-template-columns: 1fr;
  }

  .insight-card { width: 126px; }
  .dist-bars { height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .card-enter, .tile-anim { animation: none; opacity: 1; transform: none; }
  .dist-bar { transition: none; }
  .sk-img, .sk-line, .sk-pill { animation: none; }
}

/* ========================================================
   ANALYTICS FEATURES — PACK EV / HISTORY / RARITY / DELTAS
   ======================================================== */

/* ---------- Pack EV ratio badge on tile ---------- */
.ev-ratio {
  font-size: 0.66rem;
  font-weight: 800;
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  vertical-align: 2px;
  letter-spacing: 0.3px;
}
.ev-good { background: rgba(61,220,132,0.18); color: var(--up); }
.ev-ok   { background: rgba(255,203,5,0.15);  color: var(--accent); }
.ev-bad  { background: rgba(255,93,93,0.18);  color: var(--down); }

/* ---------- Set value history chart panel ---------- */
.set-hist-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.set-hist-delta {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- Rarity breakdown panel ---------- */
.rb-title {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.5rem;
}
.rb-header {
  border-bottom: 1px solid var(--line) !important;
  padding-bottom: 0.35rem;
  margin-bottom: 0.1rem;
}
.rb-header .rb-rarity,
.rb-header .rb-count,
.rb-header .rb-total,
.rb-header .rb-avg {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rb-row {
  display: flex;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(42,49,88,0.35);
  font-size: 0.82rem;
}
.rb-row:last-child { border-bottom: none; }
.rb-rarity { flex: 1; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-count  { width: 48px; text-align: right; color: var(--muted); font-weight: 600; font-size: 0.78rem; }
.rb-total  { width: 72px; text-align: right; color: var(--accent); font-weight: 700; }
.rb-avg    { width: 65px; text-align: right; color: var(--muted); font-size: 0.76rem; }

/* ---------- Delta badge on card tile ---------- */
.rarity-group {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}
.card-delta {
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: 4px;
  padding: 0.07rem 0.24rem;
  flex: 0 0 auto;
  white-space: nowrap;
}
.card-delta.up   { background: rgba(61,220,132,0.18); color: var(--up); }
.card-delta.down { background: rgba(255,93,93,0.18);  color: var(--down); }

/* ---------- Cardmarket delta panel in modal ---------- */
.cm-trend-panel {
  margin: 0.75rem 0 0.5rem;
  background: rgba(24,29,54,0.6);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}
.cmt-head {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}
.cmt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 0.55rem;
}
.cmt-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.cmt-label {
  font-size: 0.66rem;
  color: var(--muted);
}
.cmt-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.delta-mini {
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: 4px;
  padding: 0.07rem 0.24rem;
  flex: 0 0 auto;
}
.delta-mini.up   { background: rgba(61,220,132,0.18); color: var(--up); }
.delta-mini.down { background: rgba(255,93,93,0.18);  color: var(--down); }

/* ========================================================
   NEW FEATURES — MARKET STATS / TABLE VIEW / GROWTH CHART
   ======================================================== */

/* ---------- Tile inline delta badge ---------- */
.tile-delta {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: 4px;
  padding: 0.07rem 0.26rem;
  vertical-align: 2px;
  margin-left: 3px;
}
.tile-delta.up   { background: rgba(61,220,132,0.18); color: var(--up); }
.tile-delta.down { background: rgba(255,93,93,0.18);  color: var(--down); }

/* ---------- Market stats bar on dashboard ---------- */
.market-stats {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 1.1rem;
  margin-bottom: 0.5rem;
}
.ms-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ms-label {
  font-size: 0.63rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ms-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}
.ms-delta {
  font-size: 0.6rem;
  font-weight: 800;
}
.ms-delta.up   { color: var(--up); }
.ms-delta.down { color: var(--down); }
.ms-sep {
  color: var(--line);
  font-size: 1rem;
  align-self: stretch;
  display: flex;
  align-items: center;
}
.ms-link {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-2);
  text-decoration: none;
  white-space: nowrap;
}
.ms-link:hover { color: var(--accent); }

@media (max-width: 600px) {
  .ms-sep { display: none; }
  .market-stats { gap: 0.6rem 1rem; }
  .ms-link { margin-left: 0; }
}

/* ---------- View toggle (Grid / Table) ---------- */
.view-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.vtbtn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.38rem 0.65rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  transition: background 0.13s, color 0.13s;
}
.vtbtn.active {
  background: var(--accent-2);
  color: #fff;
}
.vtbtn:not(.active):hover {
  background: rgba(42, 49, 88, 0.55);
  color: var(--text);
}

/* ---------- Card table view ---------- */
.card-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}
.card-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.card-table th {
  text-align: left;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.ct-row {
  border-bottom: 1px solid rgba(42, 49, 88, 0.4);
  cursor: pointer;
  transition: background 0.12s;
}
.ct-row:hover { background: var(--card-hover); }
.ct-row td { padding: 0.3rem 0.65rem; vertical-align: middle; }
.ct-img { width: 40px; }
.ct-img img { width: 36px; height: auto; border-radius: 3px; display: block; }
.ct-name { font-weight: 600; max-width: 200px; }
.ct-num { color: var(--muted); white-space: nowrap; font-size: 0.78rem; }
.ct-price { font-weight: 800; color: var(--accent); white-space: nowrap; }

@media (max-width: 600px) {
  .ct-num, .card-table th:nth-child(3) { display: none; }
}

/* ---------- Muted helper ---------- */
.muted { color: var(--muted); }

/* ========================================================
   PREMIUM UPGRADES v7 — SEARCH / MOBILE NAV / SENTIMENT
   ======================================================== */

/* ---------- Global polish ---------- */
html { scroll-behavior: smooth; }

.panel { transition: border-color 0.22s; }
.panel:hover { border-color: rgba(42, 49, 88, 0.9); }

.tile {
  cursor: default;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.18s;
}
.tile:hover {
  border-color: rgba(255, 203, 5, 0.18);
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  transform: translateY(-2px);
}

/* ---------- Global search overlay (Cmd+K) ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(10vh, 80px) 1rem 2rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.search-overlay[hidden] { display: none; }

.search-box {
  background: var(--bg-2);
  border: 1px solid rgba(61, 125, 202, 0.45);
  border-radius: 18px;
  width: min(620px, 100%);
  box-shadow: 0 36px 90px rgba(0,0,0,0.72), 0 0 0 1px rgba(61,125,202,0.12);
  overflow: hidden;
  animation: search-in 0.18s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes search-in {
  from { opacity: 0; transform: scale(0.94) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.search-icon { flex: 0 0 auto; width: 20px; height: 20px; color: var(--muted); }

#global-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1.05rem;
  font-family: inherit;
  min-width: 0;
}
#global-search-input::placeholder { color: var(--muted); }

.search-esc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.12rem 0.45rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  flex: 0 0 auto;
}

.search-results {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.search-hint, .search-loading {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.search-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.search-result {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(42,49,88,0.4);
  transition: background 0.1s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.focused {
  background: rgba(61,125,202,0.09);
}

.search-result img {
  width: 44px;
  border-radius: 5px;
  flex: 0 0 auto;
  background: #0a0d18;
  object-fit: contain;
  aspect-ratio: 0.717;
}

.sr-info { flex: 1; min-width: 0; }
.sr-name  { font-size: 0.92rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-set   { font-size: 0.72rem; color: var(--muted); margin-top: 1px; }
.sr-rarity { font-size: 0.65rem; color: var(--muted); }
.sr-price { font-size: 0.97rem; font-weight: 800; color: var(--accent); white-space: nowrap; flex: 0 0 auto; }

.search-footer {
  display: flex;
  gap: 1.25rem;
  padding: 0.5rem 1.1rem;
  border-top: 1px solid var(--line);
  background: rgba(17,21,42,0.4);
}
.search-footer span { font-size: 0.7rem; color: var(--muted); }

/* ---------- Search button in header ---------- */
.search-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  padding: 0.42rem 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  transition: border-color 0.15s, color 0.15s;
  flex: 0 0 auto;
  white-space: nowrap;
}
.search-btn:hover { color: var(--text); border-color: var(--accent-2); }

.search-btn-hint { display: flex; gap: 2px; align-items: center; }
.search-btn-hint kbd {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  font-size: 0.65rem;
  font-family: inherit;
  color: var(--muted);
  line-height: 1.55;
}

/* ---------- Mobile bottom navigation ---------- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(12,15,29,0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  gap: 0;
  justify-content: space-around;
}

.mbn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  padding: 0.6rem 0.15rem 0.45rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 56px;
}
.mbn-item svg { width: 22px; height: 22px; flex: 0 0 auto; }
.mbn-item.active { color: var(--accent); }
.mbn-item:not(.active):hover { color: var(--text); }

/* ---------- Market Sentiment Gauge ---------- */
.sentiment-section { margin: 0.9rem 0 1.1rem; }

.sentiment-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.sentiment-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.gauge-svg { width: 200px; max-width: 100%; display: block; }

.gauge-reading {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  justify-content: center;
  line-height: 1;
}
.gauge-score  { font-size: 2.1rem; font-weight: 900; }
.gauge-label  { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; }

.sentiment-stats { flex: 1; min-width: 180px; }
.sent-label {
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.15rem;
}
.sent-sub { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.7rem; }

.sent-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.sent-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
}
.sent-stat-label { font-size: 0.64rem; color: var(--muted); font-weight: 600; }
.sent-stat-val   { font-size: 1.15rem; font-weight: 800; }

/* ---------- Animated tile count-up ---------- */
.t-num { display: inline; }

/* ---------- Chart gradient fills ---------- */
.chart-wrap canvas { border-radius: 6px; }

/* ---------- Mobile adjustments for v7 features ---------- */
@media (max-width: 700px) {
  .mobile-bottom-nav { display: flex; }
  main { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 72px) !important; }
  body > .footer { margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); }

  /* Hide header nav on mobile — bottom dock handles navigation */
  .header .nav { display: none; }
  .header { justify-content: space-between; }

  .search-btn-hint { display: none; }
  .search-btn { padding: 0.42rem 0.55rem; }
  .sentiment-card { gap: 1rem; }
  .gauge-svg { width: 170px; }
}

@media (max-width: 430px) {
  .mbn-item { font-size: 0.5rem; }
  .mbn-item svg { width: 20px; height: 20px; }
  .sent-detail-grid { grid-template-columns: 1fr; }
}
