.market-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 18px;
  background: #0a2b31;
  color: white;
  padding: clamp(18px, 2.4vw, 32px);
}
.market-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 40%;
  background: linear-gradient(90deg, #0a2b31 1%, #0a2b318c 39%, #0a2b3126),
    url("../img/coins.6d68d3febc52.webp") center 73% / cover;
}
.market-hero h1 {
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1;
  letter-spacing: -.055em;
}
.market-hero p { max-width: 48ch; margin-top: 14px; color: #e0eeeb; font-size: clamp(15px, 1.4vw, 18px); }
.market-shortcuts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 16px; }
.market-shortcuts a { color: #e3fff2; font-size: 13px; font-weight: 650; text-decoration: underline; text-underline-offset: 4px; }
.market-shortcuts a:hover { color: white; }
.market-panel { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: clamp(16px, 2vw, 28px); }
#market-chart { scroll-margin-top: 12px; margin-top: 16px; }
.market-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.coin-logo, .ticker-mark, .fx-mark, .element-mark { flex: none; width: 34px; height: 34px; }
.ticker-mark, .element-mark { display: grid; place-content: center; text-align: center; line-height: 1; }
.ticker-mark { background: #e6eef8; color: #1d4775; border-radius: 9px; font-size: 10px; font-weight: 800; }
.ticker-energy { background: #e0f0e6; color: #23603c; }
.ticker-indices { background: #eee9fa; color: #5e4288; }
.element-mark {
  box-shadow: inset 0 0 0 1px #0002;
  color: #483512;
  border-radius: 6px;
  font: 700 16px/1 Georgia, serif;
  background: linear-gradient(135deg, #fff5cb, #dcb85e);
}
.element-mark small { text-align: start; font: 600 8px/1 Inter, sans-serif; }
.element-Ag { background: linear-gradient(135deg, #fff, #c2cdd7); color: #384a58; }
.element-Pt { background: linear-gradient(135deg, #f5f1ed, #c7b6a7); color: #4c403b; }
.element-Pd { background: linear-gradient(135deg, #f6f3ff, #bdb7cf); color: #423951; }
.element-Cu { background: linear-gradient(135deg, #ffe4c8, #d69f7d); color: #623716; }
.fx-mark { position: relative; }
.fx-mark b { position: absolute; inset-inline-start: 0; top: 1px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: white; background: #294875; font: 700 12px/1 Inter, sans-serif; }
.fx-mark b + b { inset-inline-start: 12px; top: 11px; background: #16735c; box-shadow: 0 0 0 2px white; }
.market-news { margin-top: 36px; }
.market-news .sectionhead { margin-bottom: 16px; }
@media (max-width: 780px) {
  .market-hero::before { inset-inline-start: 25%; opacity: .5; }
  .market-hero p { max-width: 38ch; }
}
@media (max-width: 480px) {
  .market-hero { padding: 24px 20px; }
  .market-panel { padding-inline: 10px; }
  .market-panel h2, .market-note { margin-inline: 5px; }
}

.quote-heading, .quote-controls, .quote-controls nav, .quote-meta, .quote-inspect, .quote-figure figcaption {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.quote-heading { gap: 12px; }
.quote-heading p, .quote-meta { font-size: 13px; color: var(--muted); }
.quote-heading h2 { margin: 0; }
.quote-number { margin: 16px 0 2px; font-variant-numeric: tabular-nums; color: var(--muted); }
.quote-number strong { color: var(--ink); font-size: clamp(28px, 5vw, 46px); letter-spacing: -.045em; }
.quote-controls { justify-content: space-between; margin: 22px 0 10px; }
.quote-controls nav a { padding: 5px 9px; color: var(--muted); border: 1px solid var(--border); border-radius: 7px; font-size: 13px; }
.quote-controls a[aria-current] { background: #105b50; color: white; }
.quote-change { color: #12694e; font-weight: 700; }
.quote-change.falls { color: #a23c37; }
.quote-figure { margin: 0; }
.quote-figure svg { display: block; width: 100%; height: clamp(140px, 22vw, 240px); }
.quote-axis, .quote-figure figcaption { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.quote-plot { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.quote-axis { grid-column: 2; grid-row: 1; flex-direction: column; text-align: end; height: clamp(140px, 22vw, 240px); justify-content: space-between; padding-block: 8px; margin-inline-start: 8px; }
.quote-figure svg { grid-column: 1; grid-row: 1; min-width: 0; overflow: hidden; }
.quote-figure polyline, .quote-grid, .quote-cursor { fill: none; vector-effect: non-scaling-stroke; }
.quote-figure polyline { stroke: #137566; stroke-width: 2.3px; stroke-linejoin: round; }
.quote-figure polygon { fill: #15786512; }
.quote-grid, .quote-cursor { stroke: #bdccc8; stroke-dasharray: 3 4; }
.quote-inspect { margin-top: 14px; font-size: 12px; color: var(--muted); }
.quote-inspect[hidden] { display: none; }
.quote-inspect input { min-width: 60px; width: 90px; padding: 0; accent-color: #137566; }
.quote-inspect output { font-variant-numeric: tabular-nums; }
.market-note a, .quote-empty a { text-decoration: underline; }
.quote-empty { margin-block: 28px; }

.market-board { margin-top: clamp(18px, 2.5vw, 32px); scroll-margin-top: 12px; }
.market-board [hidden] { display: none; }
.board-heading, .board-filters, .board-search, .tile-heading, .tile-stats, .source-strip, .source-strip div {
  display: flex; align-items: center;
}
.board-heading { justify-content: space-between; gap: 12px; }
.board-heading h2 { margin: 0; font-size: clamp(21px, 2.6vw, 32px); line-height: 1.1; letter-spacing: -.045em; }
.board-search { gap: 7px; padding: 5px 10px; color: var(--muted); background: white; border: 1px solid var(--border); border-radius: 8px; }
.board-search:focus-within { outline: 2px solid #157661; }
.board-search .icon { width: 16px; height: 16px; }
.board-search input { width: 18ch; min-width: 0; padding: 2px 0; outline: 0; border: 0; font: inherit; font-size: 13px; background: transparent; }
.board-filters { gap: 5px; margin-top: 13px; flex-wrap: wrap; }
.board-filters button { padding: 6px 11px; border-radius: 20px; border: 1px solid var(--border); color: #35544d; font: 600 13px/1.3 Inter, sans-serif; background: white; cursor: pointer; }
.board-filters button[aria-pressed="true"] { color: white; background: #184e44; border-color: #184e44; }
.chart-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-top: 14px; }
.chart-tile {
  --trend: #14745c; --wash: #14745c12;
  display: grid; grid-template-columns: 1fr auto; align-content: start; min-width: 0;
  padding: 13px 14px 10px; color: var(--ink); background: white;
  border: 1px solid var(--border); border-radius: 12px;
}
.chart-tile.falling { --trend: #aa453c; --wash: #aa453c10; }
.chart-tile:hover, .chart-tile:focus-visible { border-color: #63958a; box-shadow: 0 3px 12px #163f3412; }
.chart-tile[aria-busy="true"] { cursor: progress; }
.tile-heading { grid-column: 1 / -1; gap: 9px; min-width: 0; }
.tile-heading > span:last-child { display: grid; gap: 2px; min-width: 0; }
.tile-heading strong { font-size: 15px; line-height: 1.15; }
.tile-heading > span:last-child small, .tile-quote small, .tile-stats span, .chart-tile time { color: var(--muted); font-size: 11px; }
.tile-quote { grid-column: 1 / -1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; margin-top: 9px; font-variant-numeric: tabular-nums; }
.tile-quote b { font-size: clamp(18px, 2vw, 25px); line-height: 1.2; letter-spacing: -.045em; }
.chart-tile svg { grid-column: 1 / -1; display: block; width: 100%; height: 37px; margin: 5px 0 7px; }
.chart-tile polyline { fill: none; stroke: var(--trend); stroke-width: 1.65px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.chart-tile polygon { fill: var(--wash); }
.tile-stats { gap: 5px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.tile-stats strong { font-size: 12px; color: var(--trend); }
.chart-tile time { align-self: end; text-align: end; padding-inline-start: 4px; }
.tile-credit { grid-column: 1 / -1; color: var(--muted); font-size: 10px; margin-top: 3px; }
.tile-empty { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.source-strip { gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.source-strip h3 { margin: 0; font-size: 14px; }
.source-strip div { flex-wrap: wrap; gap: 5px; }
.source-strip a { font-size: 12px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.source-strip a:hover { text-decoration: underline; }
.board-empty { color: var(--muted); padding-block: 16px; }
.chart-dialog { width: min(700px, calc(100% - 24px)); max-height: 90vh; max-height: 90dvh; box-sizing: border-box; padding: 0; border: 0; border-radius: 16px; color: var(--ink); background: white; box-shadow: 0 16px 64px #1027243b; }
.chart-dialog::backdrop { background: #10282591; }
.chart-dialog .market-panel { border: 0; }
.chart-dialog .quote-heading { padding-inline-end: 34px; }
.chart-dialog form { margin: 0; }
.chart-close { position: absolute; inset-block-start: 12px; inset-inline-end: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: #f4f7f6; color: var(--ink); font: 24px/1 sans-serif; cursor: pointer; }
@media (max-width: 980px) { .chart-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 665px) {
  .chart-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
  .chart-tile { padding: 10px; }
  .chart-tile time, .tile-stats { grid-column: 1 / -1; text-align: start; padding: 0; }
  .tile-heading .coin-logo, .tile-heading .element-mark, .tile-heading .ticker-mark { width: 28px; height: 28px; }
  .tile-heading strong { font-size: 13px; }
  .board-filters button { font-size: 12px; padding: 6px 9px; }
  .board-search input { width: 14ch; }
}
@media (max-width: 400px) {
  .board-heading { align-items: stretch; flex-direction: column; }
  .board-search input { flex: 1; }
}
