@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #06090f;
  --bg-elev: #0b111a;
  --surface: #101824;
  --surface-2: #131d2a;
  --surface-3: #182332;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #e7ecf3;
  --text-dim: #8a99a8;
  --text-faint: #5a6776;
  --accent: #00ff88;
  --accent-soft: rgba(0, 255, 136, 0.12);
  --accent-line: rgba(0, 255, 136, 0.32);
  --warn: #facc15;
  --danger: #f87171;
  --r-sm: 0.625rem;
  --r-md: 0.875rem;
  --r-lg: 1.125rem;
  --r-xl: 1.5rem;
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --ring: 0 0 0 3px rgba(0, 255, 136, 0.18);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body { overflow-x: hidden; }

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(0, 255, 136, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(86, 132, 255, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  margin: 0;
}

::selection { background: rgba(0, 255, 136, 0.3); color: #fff; }

header, main {
  margin-left: auto;
  margin-right: auto;
  max-width: 1040px;
  width: 100%;
}

nav.bottom-nav-bg { width: 100vw; }

h1 { letter-spacing: -0.025em; }
h2 { letter-spacing: -0.015em; }

/* Tailwind alias colours from index.html */
.text-neon-green { color: var(--accent); }
.bg-neon-green { background-color: var(--accent); }
.border-neon-green { border-color: var(--accent); }
.text-text-muted { color: var(--text-dim); }
.bg-card-bg { background-color: var(--surface); }
.bg-surface-bg { background-color: var(--surface-2); }
.bg-dark-navy { background-color: var(--bg-elev); }
.border-border-color { border-color: var(--line); }

/* ───────── Header ───────── */
header {
  border-bottom: 1px solid transparent;
  transition: border-color 220ms var(--ease), background 220ms var(--ease);
}
header.bg-dark-navy\/95 {
  background: rgba(6, 9, 15, 0.72) !important;
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px);
  border-bottom-color: var(--line);
}

/* ───────── Hero ───────── */
.hero-glow {
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(0, 255, 136, 0.18), transparent 55%),
    radial-gradient(80% 70% at 0% 100%, rgba(86, 132, 255, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  position: relative;
  isolation: isolate;
  padding: 1.5rem 1.25rem 1.25rem;
}
.hero-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(70% 80% at 30% 30%, #000 0%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}
.hero-glow > * { position: relative; z-index: 1; }

.hero-glow h1 {
  font-weight: 800;
  font-size: clamp(1.65rem, 5.6vw, 2rem);
  line-height: 1.08;
}
.hero-glow p { line-height: 1.5; }

.planet-graphic {
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.9), transparent 22%),
    radial-gradient(circle at 70% 38%, rgba(0, 255, 136, 0.85), transparent 28%),
    radial-gradient(120% 120% at 50% 50%, rgba(0, 255, 136, 0.18), rgba(6, 9, 15, 0.6) 60%, transparent 80%);
  border: 1px solid rgba(0, 255, 136, 0.38);
  border-radius: 50%;
  box-shadow:
    0 0 80px rgba(0, 255, 136, 0.18),
    inset -20px -28px 60px rgba(0, 0, 0, 0.55),
    inset 14px 12px 40px rgba(0, 255, 136, 0.18);
  filter: saturate(115%);
  height: 220px;
  opacity: 0.9;
  pointer-events: none;
  position: absolute;
  right: -90px;
  top: 18px;
  width: 220px;
  z-index: 0;
}

/* ───────── Stats grid (rendered by app.js) ───────── */
#stats > div {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 70%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 0.875rem 1rem;
  transition: border-color 200ms var(--ease), transform 200ms var(--ease);
}
#stats > div:hover { border-color: var(--line-strong); }
#stats .text-2xl {
  font-feature-settings: 'tnum', 'cv11';
  letter-spacing: -0.02em;
}

/* ───────── Bottom nav ───────── */
.bottom-nav-bg {
  background: rgba(6, 9, 15, 0.78);
  border-top: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  backdrop-filter: saturate(140%) blur(18px);
}
.bottom-item {
  align-items: center;
  border-radius: 0.75rem;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.35rem 0.6rem;
  transition: color 200ms var(--ease), background 200ms var(--ease);
}
.bottom-item:hover { color: var(--text); }
.bottom-item.active,
.bottom-item.text-neon-green {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ───────── Scrollbar utility ───────── */
.custom-scrollbar::-webkit-scrollbar { display: none; }
.custom-scrollbar {
  -ms-overflow-style: none;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

/* ───────── Filters / search ───────── */
.market-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.market-search-row {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: minmax(0, 1fr) 3.15rem;
}
.market-search { min-width: 0; position: relative; }
.market-search-icon {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  inset: 0 auto 0 0;
  padding-left: 1.05rem;
  pointer-events: none;
  position: absolute;
}
.market-search-icon svg { height: 1.05rem; width: 1.05rem; }

.market-search-input {
  background: var(--surface) !important;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  color: var(--text) !important;
  font-size: 0.9rem;
  height: 3.15rem;
  outline: none;
  padding: 0 1rem 0 3.35rem !important;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
  width: 100%;
}
.market-search-input::placeholder { color: var(--text-faint); }

.market-search-input:focus,
.filter-select:focus,
.market-icon-button:focus,
.filter-label-button:focus,
.market-explore-button:focus,
.wallet-input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
  outline: none;
}

.market-icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  color: var(--text-dim);
  display: inline-flex;
  height: 3.15rem;
  justify-content: center;
  transition: border-color 180ms var(--ease), color 180ms var(--ease), background 180ms var(--ease);
  width: 3.15rem;
}
.market-icon-button:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--text);
}

.market-filter-row {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(6.75rem, 0.85fr);
  overflow-x: auto;
  padding-bottom: 0.05rem;
}

.filter-select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--text-dim) 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%) calc(100% - 14px) 50% / 6px 6px no-repeat,
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 500;
  height: 2.75rem;
  min-width: 0;
  overflow: hidden;
  padding: 0 2.25rem 0 0.95rem;
  text-overflow: ellipsis;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
  white-space: nowrap;
  width: 100%;
}
.filter-select:hover { border-color: var(--line-strong); }
#risk { min-width: 0; }

.filter-label-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 0.5rem;
  height: 2.75rem;
  justify-content: center;
  padding: 0 1rem;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
  white-space: nowrap;
}
.filter-label-button:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

#view-all, #view-all-market { flex-shrink: 0; }

.market-explore-button {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(0, 255, 136, 0.08), rgba(0, 255, 136, 0.02));
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  box-shadow: 0 1px 0 rgba(0, 255, 136, 0.18) inset;
  color: var(--accent);
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 700;
  gap: 0.55rem;
  height: 3rem;
  justify-content: center;
  letter-spacing: 0.005em;
  margin-top: 0.1rem;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease);
  width: 100%;
}
.market-explore-button:hover {
  background: linear-gradient(180deg, rgba(0, 255, 136, 0.14), rgba(0, 255, 136, 0.04));
  border-color: rgba(0, 255, 136, 0.55);
}
.market-explore-button:active { transform: translateY(1px); }

/* ───────── Freshness ───────── */
.freshness-line {
  align-items: center;
  color: var(--text-faint);
  display: flex;
  font-size: 0.7rem;
  font-weight: 600;
  gap: 0.6rem;
  letter-spacing: 0.06em;
  margin-top: -0.5rem;
  text-transform: uppercase;
}
.freshness-line span:first-child { color: var(--accent); }
.freshness-line .stale { color: var(--warn); }

/* ───────── Menu panel ───────── */
#menu-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.menu-item {
  background: transparent;
  border-radius: 0.65rem;
  color: var(--text);
  display: block;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 0.6rem 0.75rem;
  text-align: left;
  transition: background 160ms var(--ease), color 160ms var(--ease);
  width: 100%;
}
.menu-item:hover { background: var(--surface-2); color: var(--accent); }

/* ───────── Market cards ───────── */
.market-card {
  animation: soft-enter 260ms var(--ease-out) both;
  animation-delay: var(--enter-delay, 0ms);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 60%),
    var(--surface) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
  transition: border-color 200ms var(--ease), background 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
  will-change: transform, opacity;
  gap: 0.75rem;
}
.market-card:hover {
  background:
    linear-gradient(180deg, rgba(0, 255, 136, 0.04), transparent 60%),
    var(--surface) !important;
  border-color: var(--accent-line) !important;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.market-card:active { transform: translateY(0) scale(0.997); }
.market-card .text-neon-green {
  font-feature-settings: 'tnum';
  letter-spacing: -0.01em;
}
.market-card-main {
  flex: 1 1 auto;
  min-width: 0;
}
.market-card-title {
  max-width: min(22rem, 34vw);
}
.market-card-metrics {
  flex: 0 1 min(52%, 26rem);
  justify-content: flex-end;
  min-width: 0;
}
.market-yield-block {
  align-items: flex-end;
  min-width: 0;
  max-width: 100%;
}
.market-yield-block > span:first-child { align-self: flex-end; }
.market-yield-value {
  display: block;
  line-height: 1.15;
  max-width: 18rem;
  overflow: visible;
  text-align: right;
  text-overflow: clip;
  white-space: nowrap;
}
.market-tvl-block {
  flex: 0 0 auto;
  min-width: 4.5rem;
}

@media (min-width: 521px) {
  .market-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(8rem, max-content) minmax(6rem, max-content) max-content;
    align-items: center;
    column-gap: 1.5rem;
  }
  .market-card-main { width: auto; min-width: 0; }
  .market-card-metrics { display: contents !important; }
  .market-yield-block,
  .market-tvl-block { align-items: flex-start; }
  .market-yield-block > span:first-child,
  .market-tvl-block > span:first-child { align-self: flex-start; text-align: left; }
  .market-yield-value { text-align: left; max-width: none; }
}
.trend-badge {
  align-self: flex-start;
  border-radius: 999px;
  display: inline-flex;
  font-feature-settings: 'tnum';
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  margin-top: 0.18rem;
  padding: 0.25rem 0.4rem;
  white-space: nowrap;
}
.trend-badge.up {
  background: rgba(0, 255, 136, 0.12);
  border: 1px solid rgba(0, 255, 136, 0.3);
  color: var(--accent);
}
.trend-badge.down {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: var(--danger);
}
.trend-badge.up,
.trend-badge.down { animation: trend-pop 520ms var(--ease-out) both; }
.trend-badge.hot {
  box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.08);
}

/* ───────── Activity cards ───────── */
.activity-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.activity-card {
  align-items: center;
  animation: soft-enter 260ms var(--ease-out) both;
  animation-delay: var(--enter-delay, 0ms);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  min-width: 0;
  padding: 0.9rem;
  transition: border-color 200ms var(--ease), background 200ms var(--ease), transform 200ms var(--ease);
}
.activity-card:hover {
  background:
    linear-gradient(180deg, rgba(236, 72, 153, 0.06), transparent 60%),
    var(--surface);
  border-color: rgba(236, 72, 153, 0.45);
  transform: translateY(-1px);
}
.activity-card-main {
  align-items: center;
  display: flex;
  gap: 0.65rem;
  min-width: 0;
}
.activity-card-main > div { min-width: 0; }
.activity-card-main span,
.activity-card-meta strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-card-main small,
.activity-card-meta em {
  color: var(--text-dim);
  display: block;
  font-size: 0.72rem;
  font-style: normal;
  margin-top: 0.12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-card-meta {
  flex: 0 1 45%;
  min-width: 0;
  text-align: right;
}
.activity-card-meta strong { color: var(--accent); }

/* ───────── Token icon ───────── */
.token-icon {
  align-items: center;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.7), transparent 22%),
    linear-gradient(145deg, var(--token-a), var(--token-b));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  box-shadow: inset 0 -6px 14px rgba(0, 0, 0, 0.28), 0 6px 18px rgba(0, 0, 0, 0.28);
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.58rem;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  overflow: hidden;
  position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.token-icon img {
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
  z-index: 2;
}
.token-icon span { position: relative; z-index: 1; }
.token-icon-has-logo {
  background: #0a121d;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
  text-shadow: none;
}
.token-icon-md { height: 2.5rem; min-height: 2.5rem; min-width: 2.5rem; width: 2.5rem; }
.token-icon-sm { font-size: 0.5rem; height: 1.85rem; min-height: 1.85rem; min-width: 1.85rem; width: 1.85rem; }

.pair-icon {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  min-width: 2.8rem;
  padding-left: 0.15rem;
}
.pair-icon .token-icon + .token-icon { margin-left: -0.7rem; }

.token-rail { display: flex; gap: 0.35rem; margin-top: 0.75rem; }

/* ───────── Token panel ───────── */
.token-panel { display: grid; gap: 1rem; }
.token-panel-head, .token-panel-title, .token-market {
  align-items: center;
  display: flex;
}
.token-panel-head { justify-content: space-between; gap: 1rem; }
.token-panel-title {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  min-width: 0;
}
.token-panel-title > div { min-width: 0; }
.token-panel-title h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.token-panel-title p {
  color: var(--text-dim);
  font-size: 0.76rem;
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-clear {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}
.token-clear:hover { background: var(--surface-3); border-color: var(--line-strong); }

.token-panel-metrics {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(3, 1fr);
}
.token-panel-metrics div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-width: 0;
  padding: 0.75rem;
}
.token-panel-metrics span {
  color: var(--text-faint);
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.token-panel-metrics strong {
  display: block;
  font-feature-settings: 'tnum';
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-panel-list { display: grid; gap: 0.5rem; }

.token-market {
  animation: soft-enter 240ms var(--ease-out) both;
  animation-delay: var(--enter-delay, 0ms);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  display: grid;
  gap: 0.7rem;
  grid-template-columns: max-content minmax(0, 1fr) minmax(7rem, max-content);
  min-width: 0;
  padding: 0.7rem;
  text-align: left;
  transition: border-color 180ms var(--ease), background 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease);
  width: 100%;
}
.token-market:hover {
  background: var(--surface-3);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.token-market:active { transform: translateY(0); }
.token-market span { display: grid; min-width: 0; }
.token-market strong, .token-market small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.token-market strong { font-size: 0.86rem; font-weight: 600; }
.token-market small { color: var(--text-dim); font-size: 0.72rem; }
.token-market em {
  color: var(--accent);
  flex-shrink: 0;
  font-feature-settings: 'tnum';
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1.15;
  max-width: 18rem;
  overflow: visible;
  text-align: right;
  text-overflow: clip;
  white-space: nowrap;
}
.token-market-metrics {
  align-items: end;
  display: grid !important;
  gap: 0.12rem;
  justify-items: end;
  min-width: 0;
}
.token-market-metrics .trend-badge {
  align-self: end;
  justify-self: end;
  margin-top: 0;
}
.token-market-metrics b {
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ───────── Wallet ───────── */
.wallet-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 70%),
    var(--surface) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-sm);
}
.wallet-form {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  position: relative;
  width: 100%;
}
.wallet-input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 0.95rem;
  min-width: 0;
  padding: 0.78rem 4.25rem 0.78rem 0.95rem;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
  width: 100%;
}
.wallet-button {
  align-items: center;
  background: var(--accent);
  border-radius: var(--r-md);
  bottom: 0.3rem;
  color: #06110c;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  justify-content: center;
  letter-spacing: 0;
  position: absolute;
  right: 0.3rem;
  top: 0.3rem;
  transition: filter 180ms var(--ease), transform 180ms var(--ease);
  width: 3.25rem;
}
.wallet-button:hover { filter: brightness(1.08); }
.wallet-button:active { transform: scale(0.98); }
.wallet-button:disabled {
  cursor: wait;
  filter: none;
  opacity: 0.92;
}
.wallet-button-icon {
  display: none;
  height: 1.1rem;
  width: 1.1rem;
}
.wallet-button.is-scanning .wallet-button-label { display: none; }
.wallet-button.is-scanning .wallet-button-icon {
  animation: wallet-spin 850ms linear infinite;
  display: block;
}

@keyframes wallet-spin {
  to { transform: rotate(360deg); }
}

.wallet-results {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
}
.wallet-row {
  animation: soft-enter 260ms var(--ease-out) both;
  animation-delay: var(--enter-delay, 0ms);
  align-items: start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: grid;
  gap: 0.7rem;
  grid-template-columns: minmax(0, 1fr);
  padding: 0.75rem;
}
.wallet-token {
  align-items: center;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
  text-align: left;
}
.wallet-token strong, .wallet-token small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wallet-token small { color: var(--text-dim); font-size: 0.72rem; }
.wallet-market-list { gap: 0.5rem; }
.wallet-market {
  background: rgba(255, 255, 255, 0.025);
  grid-template-columns: max-content minmax(0, 1fr) minmax(7rem, max-content);
}

@media (max-width: 520px) {
  .market-card {
    align-items: flex-start !important;
    display: grid !important;
    grid-template-columns: 1fr;
    padding: 0.85rem !important;
  }
  .market-card-main { width: 100%; }
  .market-card-title { max-width: min(13rem, 54vw); }
  .market-card-metrics {
    background: rgba(255, 255, 255, 0.026);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    display: grid !important;
    gap: 0.5rem;
    grid-template-columns: minmax(0, 1fr) max-content;
    justify-content: stretch;
    max-width: none;
    padding: 0.55rem 0.65rem;
    width: 100%;
  }
  .market-card-metrics > .flex.items-center {
    display: none;
  }
  .market-yield-block {
    align-items: flex-start;
  }
  .market-yield-block > span:first-child {
    align-self: flex-start;
  }
  .market-yield-value {
    font-size: 0.86rem;
    max-width: 100%;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
  }
  .market-tvl-block {
    align-items: flex-end;
    min-width: 4rem;
  }
  .token-market {
    grid-template-columns: max-content minmax(0, 1fr) minmax(4.5rem, 34%);
  }
  .token-market em {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .wallet-market {
    grid-template-columns: max-content minmax(0, 1fr) minmax(4.5rem, 34%);
  }
  .activity-grid { grid-template-columns: 1fr; }
  .activity-card-meta { flex-basis: 38%; }
}

/* ───────── Verdict pills ───────── */
.verdict-pill {
  border-radius: 0.55rem;
  display: inline-flex;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  padding: 0.42rem 0.5rem;
}
.verdict-pill.good {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
}
.verdict-pill.watch {
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.32);
  color: var(--warn);
}
.verdict-pill.degen {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.36);
  color: var(--danger);
}
.verdict-pill.nodata {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.26);
  color: #94a3b8;
}

/* ───────── Detail sheet ───────── */
.detail-sheet[hidden],
.toast[hidden],
#menu-panel[hidden] { display: none; }

.sheet-backdrop {
  animation: sheet-backdrop-in 220ms var(--ease-out) both;
  background: rgba(2, 4, 8, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  inset: 0;
  position: fixed;
  z-index: 70;
}
.sheet-card {
  animation: sheet-up 280ms var(--ease-out) both;
  background:
    linear-gradient(160deg, rgba(0, 255, 136, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  bottom: 0;
  box-shadow: 0 -32px 90px rgba(0, 0, 0, 0.55);
  left: 0;
  max-height: min(86vh, 760px);
  overflow-y: auto;
  padding: 1.25rem 1.1rem 1.1rem;
  position: fixed;
  right: 0;
  z-index: 80;
}
.detail-sheet.is-closing .sheet-backdrop { animation: sheet-backdrop-out 200ms var(--ease) both; }
.detail-sheet.is-closing .sheet-card { animation: sheet-down 220ms var(--ease) both; }
.sheet-close {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 1.4rem;
  height: 2.5rem;
  position: absolute;
  right: 1rem;
  top: 1rem;
  transition: background 160ms var(--ease);
  width: 2.5rem;
}
.sheet-close:hover { background: var(--surface-3); }

.sheet-head {
  align-items: center;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: max-content minmax(0, 1fr);
  padding-right: 3rem;
}
.sheet-head .verdict-pill {
  grid-column: 2;
  justify-self: start;
  margin-top: -0.25rem;
}
.sheet-head .pair-icon { min-width: 3.2rem; }
.sheet-head .token-icon-sm {
  height: 2.15rem;
  min-height: 2.15rem;
  min-width: 2.15rem;
  width: 2.15rem;
}
.sheet-title { min-width: 0; }
.sheet-kicker {
  color: var(--accent);
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sheet-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.18;
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
}
.sheet-title small {
  color: var(--text-dim);
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  margin-top: 0.3rem;
  text-transform: none;
}

.sheet-metrics {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 1rem;
}
.sheet-metrics div {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 0.8rem;
}
.sheet-metrics span,
.sheet-card small {
  color: var(--text-faint);
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sheet-metrics strong {
  display: block;
  font-feature-settings: 'tnum';
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 0.35rem;
  overflow-wrap: anywhere;
}
.sheet-metrics .trend-badge {
  margin-top: 0.45rem;
}

.sheet-facts {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.75rem;
}
.sheet-facts div {
  border-bottom: 1px solid var(--line);
  min-width: 0;
  padding: 0.55rem 0;
}
.sheet-facts span {
  color: var(--text-faint);
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sheet-facts strong {
  color: var(--text);
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 0.25rem;
}
.sheet-action-note {
  background: rgba(0, 255, 136, 0.07);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  color: #c7d2df;
  font-size: 0.95rem;
  line-height: 1.55;
  margin-top: 1rem;
  padding: 0.8rem;
}
.sheet-reason-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-top: 0.75rem;
  padding: 0.8rem;
}
.sheet-reason-card > span {
  color: var(--text-faint);
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sheet-reasons {
  color: #c7d2df;
  display: grid;
  font-size: 0.86rem;
  gap: 0.4rem;
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
}
.sheet-reasons li::before { color: var(--accent); content: "• "; }
.sheet-card small { margin-top: 1rem; text-transform: none; }

.sheet-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 1rem;
}
.sheet-link {
  align-items: center;
  background: var(--accent);
  border-radius: var(--r-md);
  color: #06110c;
  display: flex;
  flex: 1 1 auto;
  font-weight: 700;
  height: 3rem;
  justify-content: center;
  letter-spacing: 0.01em;
  padding: 0 1.25rem;
  transition: filter 180ms var(--ease), transform 180ms var(--ease);
}
.sheet-link:hover { filter: brightness(1.08); }
.sheet-link:active { transform: translateY(1px); }
.sheet-link-secondary {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  flex: 0 0 auto;
}
.sheet-link-secondary:hover { filter: none; background: var(--surface-3); }

/* ───────── Toast ───────── */
.toast {
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  bottom: 6rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-weight: 600;
  left: 50%;
  opacity: 0;
  padding: 0.7rem 1.05rem;
  position: fixed;
  transform: translate(-50%, 10px) scale(0.98);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  z-index: 90;
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.toast.is-hiding {
  opacity: 0;
  transform: translate(-50%, 8px) scale(0.98);
}

/* ───────── Empty states ───────── */
.empty {
  animation: soft-enter 220ms var(--ease-out) both;
  color: var(--text-dim);
  font-size: 0.86rem;
  padding: 1.5rem 0.5rem;
  text-align: center;
}

@keyframes soft-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sheet-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheet-backdrop-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sheet-down {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(22px);
  }
}

@keyframes trend-pop {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0);
    transform: scale(0.96);
  }
  38% {
    box-shadow: 0 0 0 5px rgba(0, 255, 136, 0.1);
    transform: scale(1.04);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0);
    transform: scale(1);
  }
}

/* ───────── Responsive ───────── */
@media (max-width: 640px) {
  .market-filter-row { grid-template-columns: 1fr 1fr; overflow: visible; }
  .filter-label-button { grid-column: span 2; }

  .market-card { padding-left: 0.85rem; padding-right: 0.85rem; }
  .market-card > div:last-child { margin-right: 1rem; }
  .market-card .risk-pill { display: none; }

  .wallet-form { grid-template-columns: 1fr; }
  .wallet-button { min-height: 2.75rem; }
  .wallet-results { max-height: 44vh; }
  #view-all { display: none; }

  .planet-graphic { height: 180px; width: 180px; right: -70px; }
}

@media (max-width: 420px) {
  .sheet-metrics, .sheet-facts, .token-panel-metrics { grid-template-columns: 1fr; }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
