:root {
  --crypto-ink: #0b1730;
  --crypto-muted: #60708a;
  --crypto-line: #dce4ef;
  --crypto-panel: #ffffff;
  --crypto-bg: #f5f8fc;
  --crypto-green: #148a45;
  --crypto-red: #d63b4c;
  --crypto-blue: #2d69e0;
}

body {
  background: var(--crypto-bg);
  color: var(--crypto-ink);
}

.crypto-page {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.crypto-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.crypto-eyebrow,
.converter-label {
  color: var(--crypto-green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crypto-heading h1 {
  margin: 4px 0 5px;
  font-size: 2rem;
  line-height: 1.1;
}

.crypto-heading p {
  margin: 0;
  color: var(--crypto-muted);
}

.currency-switch,
.chart-mode,
.range-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--crypto-line);
  border-radius: 7px;
  background: #edf2f8;
}

.currency-switch button,
.chart-mode button,
.range-switch button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  padding: 0 14px;
  color: var(--crypto-muted);
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
}

.currency-switch button.active,
.chart-mode button.active,
.range-switch button.active {
  color: var(--crypto-ink);
  background: #fff;
  box-shadow: 0 1px 3px rgba(11, 23, 48, 0.12);
}

.crypto-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 760px;
  overflow: hidden;
  border: 1px solid var(--crypto-line);
  border-radius: 8px;
  background: var(--crypto-panel);
  box-shadow: 0 8px 28px rgba(21, 39, 68, 0.06);
}

.coin-sidebar {
  border-right: 1px solid var(--crypto-line);
  background: #fbfcfe;
}

.coin-search-wrap {
  position: relative;
  padding: 16px;
  border-bottom: 1px solid var(--crypto-line);
}

.coin-search-wrap svg {
  position: absolute;
  left: 29px;
  top: 28px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #718098;
  stroke-width: 2;
}

.coin-search-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 39px;
  border: 1px solid #ccd7e5;
  border-radius: 6px;
  background: #fff;
  color: var(--crypto-ink);
  font: inherit;
  box-sizing: border-box;
}

.coin-list-header {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 8px;
  padding: 11px 16px;
  color: #7b879b;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.coin-list {
  max-height: 700px;
  overflow-y: auto;
}

.coin-list-loading {
  padding: 28px 16px;
  color: var(--crypto-muted);
  text-align: center;
}

.coin-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 9px 16px;
  border: 0;
  border-top: 1px solid #e8edf4;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.coin-row:hover {
  background: #f0f5fb;
}

.coin-row.active {
  background: #eaf2ff;
  box-shadow: inset 3px 0 var(--crypto-blue);
}

.coin-rank {
  color: #7b879b;
  font-size: 0.78rem;
  text-align: center;
}

.coin-row-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.coin-row-main img {
  width: 30px;
  height: 30px;
}

.coin-row-name {
  min-width: 0;
}

.coin-row-name strong,
.coin-row-name span {
  display: block;
}

.coin-row-name strong {
  overflow: hidden;
  font-size: 0.87rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coin-row-name span {
  margin-top: 2px;
  color: var(--crypto-muted);
  font-size: 0.72rem;
}

.coin-row-price {
  text-align: right;
}

.coin-row-price strong,
.coin-row-price span {
  display: block;
}

.coin-row-price strong {
  font-size: 0.79rem;
}

.coin-row-price span {
  margin-top: 3px;
  font-size: 0.7rem;
  font-weight: 750;
}

.positive {
  color: var(--crypto-green) !important;
}

.negative {
  color: var(--crypto-red) !important;
}

.coin-workspace {
  min-width: 0;
  padding: 24px;
}

.coin-summary {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--crypto-line);
}

.coin-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.coin-identity > img {
  width: 48px;
  height: 48px;
}

.coin-title-line,
.coin-price-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.coin-title-line h2 {
  margin: 0;
  font-size: 1.35rem;
}

.coin-title-line span {
  color: var(--crypto-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.coin-price-line {
  margin-top: 4px;
}

.coin-price-line strong {
  font-size: 1.75rem;
  line-height: 1.2;
}

.change-pill {
  border-radius: 5px;
  padding: 4px 7px;
  background: #edf2f7;
  font-size: 0.78rem;
  font-weight: 800;
}

.change-pill.positive {
  background: #e6f6ec;
}

.change-pill.negative {
  background: #fdecef;
}

.updated-label {
  color: var(--crypto-muted);
  font-size: 0.74rem;
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 12px;
}

.chart-card {
  position: relative;
  height: 400px;
  border: 1px solid var(--crypto-line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

#price-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: var(--crypto-muted);
  background: rgba(255, 255, 255, 0.88);
}

.chart-loading[hidden] {
  display: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  min-width: 132px;
  padding: 8px 10px;
  border: 1px solid #ccd7e5;
  border-radius: 6px;
  background: rgba(11, 23, 48, 0.94);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(11, 23, 48, 0.18);
}

.market-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 20px;
  border: 1px solid var(--crypto-line);
  border-radius: 7px;
  background: var(--crypto-line);
  overflow: hidden;
}

.crypto-chart-ad {
  width: 100%;
  margin-top: 20px;
  overflow: hidden;
}

.crypto-chart-ad[hidden],
.crypto-chart-ad:empty {
  display: none;
}

.crypto-chart-ad .ad-placement-box,
.crypto-chart-ad .crypto-chart-ad-box {
  width: 100%;
  max-width: 100%;
  min-height: 90px;
  box-sizing: border-box;
}

.crypto-chart-ad img,
.crypto-chart-ad ins,
.crypto-chart-ad iframe {
  max-width: 100%;
}

.market-stats article {
  min-width: 0;
  padding: 16px;
  background: #fff;
}

.market-stats span,
.market-stats strong {
  display: block;
}

.market-stats span {
  color: var(--crypto-muted);
  font-size: 0.74rem;
}

.market-stats strong {
  overflow: hidden;
  margin-top: 5px;
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.converter-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--crypto-line);
  border-radius: 7px;
  background: #f8fafc;
}

.converter-card h3 {
  margin: 4px 0 0;
  font-size: 1.05rem;
}

.converter-fields {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 600px;
}

.converter-fields label {
  display: flex;
  flex: 1;
  align-items: center;
  height: 48px;
  overflow: hidden;
  border: 1px solid #ccd7e5;
  border-radius: 6px;
  background: #fff;
}

.converter-fields label span {
  align-self: stretch;
  display: grid;
  min-width: 60px;
  place-items: center;
  border-right: 1px solid #dbe3ed;
  color: var(--crypto-muted);
  background: #f1f5f9;
  font-size: 0.76rem;
  font-weight: 800;
}

.converter-fields input,
.converter-fields output {
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 0;
  color: var(--crypto-ink);
  background: #fff;
  font: inherit;
  font-weight: 750;
  box-sizing: border-box;
}

.converter-fields input {
  height: 100%;
}

.converter-equals {
  color: var(--crypto-muted);
  font-weight: 800;
}

.crypto-error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #f3bdc4;
  border-radius: 6px;
  color: #a31f32;
  background: #fff0f2;
}

.crypto-disclaimer {
  margin: 16px 0 0;
  color: var(--crypto-muted);
  font-size: 0.72rem;
}

.mobile-coin-label,
.mobile-coin-select {
  display: none;
}

.crypto-footer {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding: 34px max(24px, calc((100% - 1400px) / 2));
  color: #5e6d83;
  background: #e9eff7;
  font-size: 0.8rem;
}

.crypto-footer strong {
  color: var(--crypto-ink);
  font-size: 1rem;
}

.crypto-footer strong span {
  color: var(--crypto-green);
}

.crypto-footer p {
  margin: 5px 0 0;
}

@media (max-width: 900px) {
  .crypto-page {
    width: min(100% - 24px, 760px);
    padding-top: 22px;
  }

  .crypto-heading {
    align-items: start;
  }

  .crypto-shell {
    display: block;
  }

  .coin-sidebar {
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--crypto-line);
  }

  .coin-search-wrap,
  .coin-list-header,
  .coin-list {
    display: none;
  }

  .mobile-coin-label {
    display: block;
    margin-bottom: 6px;
    color: var(--crypto-muted);
    font-size: 0.72rem;
    font-weight: 750;
  }

  .mobile-coin-select {
    display: block;
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #ccd7e5;
    border-radius: 6px;
    background: #fff;
    color: var(--crypto-ink);
    font: inherit;
    font-weight: 700;
  }

  .chart-card {
    height: 330px;
  }
}

@media (max-width: 620px) {
  .crypto-page {
    width: 100%;
    padding: 18px 0 40px;
  }

  .crypto-heading {
    padding: 0 14px;
  }

  .crypto-heading h1 {
    font-size: 1.65rem;
  }

  .crypto-heading p {
    font-size: 0.82rem;
  }

  .currency-switch button {
    padding: 0 10px;
  }

  .crypto-shell {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .coin-workspace {
    padding: 16px 12px;
  }

  .coin-summary {
    display: block;
  }

  .updated-label {
    margin: 12px 0 0 62px;
  }

  .coin-price-line strong {
    font-size: 1.45rem;
  }

  .chart-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-mode,
  .range-switch {
    display: grid;
  }

  .chart-mode {
    grid-template-columns: 1fr 1fr;
  }

  .range-switch {
    grid-template-columns: repeat(5, 1fr);
  }

  .chart-mode button,
  .range-switch button {
    min-width: 0;
    padding: 0 5px;
  }

  .chart-card {
    height: 280px;
  }

  .market-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .converter-card,
  .converter-fields {
    align-items: stretch;
    flex-direction: column;
  }

  .converter-fields {
    width: 100%;
    gap: 8px;
  }

  .converter-equals {
    display: none;
  }

  .crypto-footer {
    display: block;
    padding: 28px 16px;
  }

  .crypto-footer > p {
    margin-top: 18px;
  }
}
