:root,
[data-theme="light"] {
  --bg: #f4f8f4;
  --panel: #ffffff;
  --line: #d9e6db;
  --text: #172620;
  --muted: #5f7668;
  --brand: #1e8d5b;
  --ghost-bg: #eff7f1;
  --green: #18aa6e;
  --red: #dc4e56;
  --shadow-soft: 0 18px 42px rgba(24, 38, 32, 0.06);
  --panel-soft: #f7fbf8;
}

[data-theme="dark"] {
  --bg: #262a31;
  --panel: #30353d;
  --line: #444a55;
  --text: #edf0f6;
  --muted: #afb6c3;
  --brand: #4b9cff;
  --ghost-bg: #3a404a;
  --green: #5fd39b;
  --red: #ff7a7a;
  --shadow-soft: 0 12px 26px rgba(0, 0, 0, 0.18);
  --panel-soft: #343a43;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; font-family: 'Onest', sans-serif; background: var(--bg); color: var(--text); scrollbar-gutter: stable; }

.container { width: min(1240px, 95%); margin: 20px auto 28px; display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-soft); }

.asset-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-width: 0; }
.asset-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.asset-title-copy { display: grid; gap: 5px; min-width: 0; }
.asset-title h1 { margin: 0; font-size: 34px; min-width: 0; overflow-wrap: anywhere; }
.muted { margin: 4px 0 0; color: var(--muted); }
.asset-logo-wrap {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
}
.asset-logo {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--line); display: grid; place-items: center;
  background: color-mix(in srgb, var(--brand) 18%, var(--ghost-bg)); font-weight: 700;
}
.asset-logo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.asset-logo-rank-badge {
  position: absolute;
  left: -3px;
  bottom: -6px;
  min-width: 30px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, var(--panel));
  background: color-mix(in srgb, var(--panel) 86%, var(--ghost-bg));
  color: var(--text);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.asset-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.asset-rank-pill {
  min-height: 32px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ghost-bg) 78%, var(--panel));
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}
.asset-logo-rank-badge.hidden,
.asset-rank-pill.hidden,
.stat-list div.hidden {
  display: none;
}

.price-box { text-align: right; min-width: 0; }
.price { font-size: 38px; font-weight: 800; overflow-wrap: anywhere; }
.change { font-size: 18px; font-weight: 700; }
.change.pos { color: var(--green); }
.change.neg { color: var(--red); }
.change-period {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.title-row h3 { margin: 0; }
.chart-mode-switch,
.asset-chart-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.asset-chart-toolbar {
  margin-top: 8px;
  justify-content: space-between;
}
.asset-chart-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ghost-bg) 68%, var(--panel));
  line-height: 1.5;
}
.range-tabs { display: flex; gap: 6px; }
.tab {
  padding: 6px 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--ghost-bg);
  color: var(--text);
  cursor: pointer;
}
.tab.active { border-color: var(--brand); color: var(--brand); }
.asset-chart-link {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.asset-chart-link:hover {
  text-decoration: underline;
}
.chart-wrap { height: 460px; margin-top: 8px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.tradingview-shell {
  margin-top: 8px;
  height: 460px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ghost-bg) 42%, var(--panel));
}
.tradingview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.stat-list { display: grid; gap: 10px; margin-top: 8px; }
.stat-list div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 7px; min-width: 0; }
.stat-list span { color: var(--muted); min-width: 0; }
.stat-list b { text-align: right; margin-left: 10px; min-width: 0; overflow-wrap: anywhere; }
.crypto-exchanges-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--panel-soft) 78%, var(--panel)) 0%, var(--panel) 58%),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.crypto-exchanges-section.hidden {
  display: none;
}

.crypto-exchanges-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.crypto-exchanges-head h3 {
  margin: 4px 0 0;
  font-size: 24px;
}

.crypto-exchanges-kicker,
.crypto-exchanges-chip,
.crypto-exchange-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ghost-bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.crypto-exchanges-kicker {
  padding: 6px 10px;
  text-transform: uppercase;
  color: var(--brand);
}

.crypto-exchanges-chip {
  padding: 6px 11px;
  color: var(--brand);
  white-space: nowrap;
}

.crypto-exchange-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.crypto-exchange-item {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  min-height: 172px;
  padding: 13px;
  display: grid;
  align-content: start;
  gap: 10px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--exchange-accent, var(--brand)) 38%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--exchange-accent, var(--brand)) 12%, transparent) 0%, transparent 58%),
    color-mix(in srgb, var(--panel) 92%, var(--ghost-bg));
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.crypto-exchange-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--exchange-accent, var(--brand)) 28%, transparent), transparent 42%),
    linear-gradient(135deg, color-mix(in srgb, var(--exchange-accent, var(--brand)) 10%, transparent), transparent 54%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.crypto-exchange-item:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--exchange-accent, var(--brand)) 64%, var(--line));
  box-shadow: 0 14px 30px color-mix(in srgb, var(--exchange-accent, var(--brand)) 16%, rgba(0, 0, 0, 0.16));
}

.crypto-exchange-item:hover::after {
  opacity: 1;
}

.crypto-exchange-top,
.crypto-exchange-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.crypto-exchange-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--exchange-accent, var(--brand)) 22%, var(--ghost-bg));
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  transition: transform 180ms ease, background-color 180ms ease;
}

.crypto-exchange-logo img {
  width: 74%;
  height: 74%;
  display: block;
  object-fit: contain;
}

.crypto-exchange-item:hover .crypto-exchange-logo {
  transform: scale(1.04);
}

.crypto-exchange-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.crypto-exchange-title strong,
.crypto-exchange-title span,
.crypto-exchange-description,
.crypto-exchange-pair {
  min-width: 0;
  overflow-wrap: anywhere;
}

.crypto-exchange-title strong {
  font-size: 16px;
  line-height: 1.2;
}

.crypto-exchange-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.crypto-exchange-pair {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 900;
}

.crypto-exchange-description {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.crypto-exchange-chip {
  min-height: 26px;
  padding: 5px 8px;
  color: var(--muted);
}

.crypto-exchange-link {
  min-height: 34px;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 180ms ease, filter 180ms ease, background-color 180ms ease;
}

.crypto-exchange-link:hover {
  filter: brightness(1.04);
}

.crypto-exchange-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--exchange-accent, var(--brand)) 70%, #ffffff);
  outline-offset: 3px;
}

.crypto-exchange-item:hover .crypto-exchange-link {
  transform: translateX(1px);
  background: color-mix(in srgb, var(--exchange-accent, var(--brand)) 34%, var(--brand));
}

.crypto-exchange-link[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.56;
}

.crypto-exchanges-disclosure {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.fundamentals-card {
  display: grid;
  gap: 18px;
  overflow: hidden;
}

.fundamentals-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.fundamentals-head h3,
.fundamentals-subhead h4 {
  margin: 0;
}

.fundamentals-kicker,
.fundamentals-label,
.fundamentals-inline-note,
.fundamentals-mini-chip,
.fundamentals-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ghost-bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fundamentals-kicker,
.fundamentals-label,
.fundamentals-inline-note,
.fundamentals-mini-chip {
  padding: 6px 10px;
}

.fundamentals-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.fundamentals-chip {
  padding: 8px 12px;
}

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

.fundamentals-chip.status-ready {
  border-color: color-mix(in srgb, var(--green) 40%, var(--line));
  color: var(--green);
}

.fundamentals-chip.status-partial {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  color: var(--brand);
}

.fundamentals-chip.status-unavailable {
  border-color: color-mix(in srgb, var(--red) 34%, var(--line));
  color: var(--red);
}

.fundamentals-topline,
.fundamentals-lower {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 16px;
}

.fundamentals-rating-panel,
.fundamentals-summary-panel,
.fundamentals-group,
.fundamentals-insight,
.fundamentals-footnotes {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-soft) 72%, var(--panel)) 0%, var(--panel) 100%);
  border-radius: 14px;
}

.fundamentals-rating-panel,
.fundamentals-summary-panel {
  padding: 16px;
  min-height: 158px;
}

.fundamentals-coverage {
  margin-top: 10px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
  font-weight: 800;
}

.fundamentals-rating-copy,
.fundamentals-summary-copy {
  margin: 12px 0 0;
  line-height: 1.55;
}

.fundamentals-groups {
  display: grid;
  gap: 16px;
}

.fundamentals-group {
  padding: 18px;
}

.fundamentals-group-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.fundamentals-metric-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fundamentals-metric {
  min-height: 196px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 92%, var(--ghost-bg));
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.fundamentals-metric.availability-unavailable {
  opacity: 0.92;
}

.fundamentals-metric-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.fundamentals-metric-head strong {
  font-size: 16px;
}

.fundamentals-metric-value {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--text);
}

.fundamentals-metric-question {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.fundamentals-metric-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.fundamentals-mini-chip {
  color: var(--muted);
  white-space: nowrap;
}

.fundamentals-insights {
  display: grid;
  gap: 12px;
}

.fundamentals-insight {
  padding: 16px;
}

.fundamentals-insight strong {
  display: block;
  margin-bottom: 8px;
}

.fundamentals-insight p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.fundamentals-insight.tone-positive {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
}

.fundamentals-insight.tone-caution {
  border-color: color-mix(in srgb, #d3a245 42%, var(--line));
}

.fundamentals-footnotes {
  margin: 0;
  padding: 16px 16px 16px 34px;
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.fundamentals-footnotes li {
  line-height: 1.55;
}

.fundamentals-subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.fundamentals-loading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.fundamentals-skeleton {
  min-height: 168px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--panel) 75%, var(--ghost-bg)) 0%, color-mix(in srgb, var(--panel-soft) 60%, var(--panel)) 50%, color-mix(in srgb, var(--panel) 75%, var(--ghost-bg)) 100%);
  background-size: 200% 100%;
  animation: assetSkeleton 1.3s linear infinite;
  border: 1px solid var(--line);
}

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

@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
  .price { font-size: 30px; }
  .asset-title h1 { font-size: 28px; }
  .chart-wrap { height: 360px; }
  .fundamentals-topline,
  .fundamentals-lower,
  .fundamentals-metric-grid,
  .crypto-exchange-grid,
  .fundamentals-loading-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fundamentals-topline,
  .fundamentals-lower,
  .fundamentals-metric-grid,
  .fundamentals-loading-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .container { width: min(1240px, calc(100% - 14px)); margin: 12px auto 20px; gap: 12px; padding-bottom: calc(18px + var(--mobile-bottom-nav-height, 82px)); }
  .card { padding: 12px; border-radius: 12px; }
  .asset-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .price-box {
    text-align: left;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  }
  .range-tabs {
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .range-tabs::-webkit-scrollbar { display: none; }
  .range-tabs .tab,
  .chart-mode-switch .tab { flex: 0 0 auto; }
  .asset-chart-toolbar {
    align-items: flex-start;
    gap: 10px;
  }
  .chart-mode-switch {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .chart-mode-switch::-webkit-scrollbar { display: none; }
  .tab {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 13px;
  }
  .chart-wrap { height: 300px; }
  .tradingview-shell { height: 300px; }
  .fundamentals-head,
  .crypto-exchanges-head,
  .fundamentals-subhead {
    flex-direction: column;
    align-items: flex-start;
  }
  .fundamentals-badges {
    justify-content: flex-start;
  }
  .fundamentals-group,
  .fundamentals-rating-panel,
  .fundamentals-summary-panel,
  .fundamentals-insight,
  .crypto-exchanges-section,
  .crypto-exchange-item,
  .fundamentals-footnotes {
    border-radius: 12px;
  }

  .stat-list div {
    gap: 8px;
  }
}

@media (max-width: 560px) {
  .asset-logo {
    width: 42px;
    height: 42px;
  }
  .title-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .asset-title h1 {
    font-size: 22px;
    line-height: 1.25;
  }
  .price {
    font-size: 26px;
    line-height: 1.15;
  }
  .change {
    font-size: 16px;
  }
  .chart-wrap { height: 250px; }
  .tradingview-shell { height: 250px; }
  .stat-list div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 6px 10px;
  }
  #stat-high-row,
  #stat-low-row,
  #stat-volume30-row {
    display: none;
  }
  .fundamentals-coverage {
    font-size: 32px;
  }
  .fundamentals-metric {
    min-height: 0;
  }
  .crypto-exchange-grid {
    grid-template-columns: 1fr;
  }
  .crypto-exchange-item {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .crypto-exchange-item,
  .crypto-exchange-item::after,
  .crypto-exchange-logo,
  .crypto-exchange-link {
    transition: none;
  }

  .crypto-exchange-item:hover,
  .crypto-exchange-item:hover .crypto-exchange-logo,
  .crypto-exchange-item:hover .crypto-exchange-link {
    transform: none;
  }
}
