/* Markets heatmap styles. The panel owns the whole viewport under the 54 px top bar; every cell is placed
   in absolute pixels by heatmap.js, so nothing here may introduce scrolling or intrinsic sizing. */

.markets-panel {
  position: relative;
  height: calc(100dvh - 54px);
  min-height: 420px;
  overflow: hidden;
  background: #0d0d10;
  contain: layout paint;
}

.hm {
  position: absolute;
  inset: 0;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  user-select: none;
}

.hm-band-layer, .hm-group-layer, .hm-cell-layer { position: absolute; inset: 0; }
.hm-group-layer { pointer-events: none; }

/* --- cells ------------------------------------------------------------------------------------ */

.hm-cell, .hm-etf {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  border-radius: 2px;
  color: #f2e7d3;
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
  transition: box-shadow .12s, filter .12s;
}

.hm-cell:hover, .hm-etf:hover {
  z-index: 8;
  filter: brightness(1.28);
  box-shadow: inset 0 0 0 1px #f2e7d3b8;
}

.hm-sym { font-weight: 650; letter-spacing: -.2px; text-shadow: 0 1px 2px #00000070; }
.hm-price { color: #f2e7d3b0; }
.hm-chg { color: #f2e7d3d8; text-shadow: 0 1px 2px #00000070; }

.hm-etf { border-radius: 3px; box-shadow: inset 0 0 0 1px #00000038; }
.hm-etf-name { font-weight: 700; letter-spacing: -.3px; text-shadow: 0 1px 3px #0009; }
.hm-etf .hm-chg { font-size: 11px; color: #f2e7d3c4; }

/* --- sector groups ---------------------------------------------------------------------------- */

.hm-group {
  position: absolute;
  overflow: hidden;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px #3a3a40;
}

.hm-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  padding: 0 6px;
  background: #1b1b1f;
  white-space: nowrap;
}

.hm-group-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: #f2e7d3;
  font-weight: 650;
  letter-spacing: .4px;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.hm-group-figures { display: flex; flex: none; align-items: center; gap: 8px; }
.hm-group-cap { color: #a5a3a0; }
.hm-group-move.is-up { color: #7fd6a4; }
.hm-group-move.is-down { color: #ef6355; }

/* --- the money panel in the reserved centre ---------------------------------------------------- */

.hm-money {
  position: absolute;
  z-index: 12;
  display: flex;
  overflow: hidden;
  border-radius: 6px;
  background: #0c0e0d;
  box-shadow: 0 0 0 1px #2f9e6355, 0 18px 54px #000000b0, inset 0 0 70px #2f9e6314;
}

.hm-rain { position: absolute; inset: 0; opacity: .72; }

.hm-money-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: 10px 13px 9px;
  background: linear-gradient(180deg, #0c0e0dd8 0%, #0c0e0da8 42%, #0c0e0de8 100%);
}

.hm-money-head { flex: none; }
.hm-eyebrow { display: block; color: #6fbf92; font-size: 8px; font-weight: 700; letter-spacing: 2.4px; }
.hm-lead { display: flex; align-items: baseline; gap: 9px; margin-top: 4px; min-width: 0; font-weight: 400; }
.hm-lead-name { overflow: hidden; color: #f2e7d3; font-size: clamp(13px, 1.5vw, 21px); font-weight: 600; letter-spacing: -.4px; text-overflow: ellipsis; white-space: nowrap; }
.hm-lead-amount { flex: none; font-size: clamp(14px, 1.6vw, 23px); font-weight: 700; letter-spacing: -.5px; }
.hm-lead-amount.is-up { color: #7fd6a4; }
.hm-lead-amount.is-down { color: #ef6355; }

.hm-rank { flex: 1; min-height: 0; margin: 7px 0 6px; padding: 0; overflow: hidden; list-style: none; }

.hm-rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(24px, 1.1fr) auto;
  align-items: center;
  gap: 8px;
  height: var(--hm-row, 19px);
  font-size: clamp(8px, .72vw, 11px);
}

.hm-rank-name { overflow: hidden; color: #cfcabd; text-overflow: ellipsis; white-space: nowrap; }
.hm-rank-track { position: relative; height: 3px; border-radius: 2px; background: #ffffff10; }
.hm-rank-bar { position: absolute; inset: 0 auto 0 0; border-radius: 2px; }
.hm-rank-row.is-up .hm-rank-bar { background: linear-gradient(90deg, #2f9e6355, #7fd6a4); }
.hm-rank-row.is-down .hm-rank-bar { background: linear-gradient(90deg, #c0392b55, #ef6355); }
.hm-rank-value { flex: none; font-weight: 650; letter-spacing: -.2px; white-space: nowrap; }
.hm-rank-row.is-up .hm-rank-value { color: #7fd6a4; }
.hm-rank-row.is-down .hm-rank-value { color: #ef6355; }

.hm-money-foot {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
  padding-top: 6px;
  border-top: 1px solid #ffffff12;
  color: #8f9a91;
  font-size: 8px;
  letter-spacing: .5px;
}

.hm-stamp { color: #6fbf92; }

/* --- tooltip and fallbacks --------------------------------------------------------------------- */

.hm-tip {
  position: absolute;
  z-index: 30;
  top: 0;
  left: 0;
  width: max-content;
  max-width: 260px;
  padding: 8px 10px;
  border-radius: 5px;
  background: #16161af6;
  box-shadow: 0 0 0 1px #45454c, 0 12px 30px #000000b8;
  color: #f2e7d3;
  font-size: 10px;
  pointer-events: none;
}

.hm-tip-name { display: block; font-size: 11.5px; font-weight: 650; letter-spacing: -.2px; }
.hm-tip-meta { display: block; margin-top: 2px; color: #a5a3a0; font-size: 9px; letter-spacing: .3px; }
.hm-tip-rows { margin-top: 6px; display: grid; gap: 2px; }
.hm-tip-row { display: flex; justify-content: space-between; gap: 16px; }
.hm-tip-row > span { color: #a5a3a0; }
.hm-tip-row > b { font-weight: 650; }

.hm-note {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  max-width: 420px;
  padding: 16px 20px;
  transform: translate(-50%, -50%);
  border: 1px dashed #39373a;
  border-radius: 8px;
  background: #19191c;
  color: #a5a3a0;
  text-align: center;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .hm-cell, .hm-etf { transition: none; }
}

/* Below the desktop top bar breakpoint the bar wraps to two rows, so the panel takes a floor instead
   of an exact viewport slice. The phone layout is a separate piece of work. */
@media (max-width: 639px) {
  .markets-panel { height: auto; min-height: calc(100dvh - 96px); }
  .hm-money-inner { padding: 8px 10px; }
}
