/* Gema TCG — heatmap, pele do design system v1.
   Sala escura: painéis nus, fio de 1px, caps espaçadas, números em mono,
   zero radius e zero sombra; só a carta tem curva. Tokens em ../tokens.css.
   Chrome (topbar/rodapé) em ../chrome.css. */
@import url("../tokens.css?v=4");

:root { font-size: 15px; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------- controles */

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
  padding: 12px 20px;
}
.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-left: auto;
}
.group { display: flex; align-items: center; background: var(--panel); }
.controls button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 9px 14px;
  cursor: pointer;
}
.controls button:hover:not(:disabled) { color: var(--ink); }
.controls button.on { background: var(--panel-2); color: var(--ink); font-weight: 600; }
.controls button:disabled { opacity: 0.35; cursor: not-allowed; }
.slider { gap: 12px; background: transparent; padding: 0 4px; }
.slider label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.slider b { color: var(--ink); font-weight: 600; }
.slider input { accent-color: var(--ink); width: 130px; }

/* abas de jogo: logo do jogo em máscara monocromática (a palavra inteira),
   riftbound fica em texto até existir um logo utilizável */
.games { display: flex; background: transparent; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.games::-webkit-scrollbar { display: none; }
.games button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  background: var(--panel);
  flex: none;
}
.games button.on { background: var(--panel-2); }
.games .gt-logo {
  display: block;
  height: 22px;
  background: currentColor;
  -webkit-mask: var(--m) no-repeat center / contain;
  mask: var(--m) no-repeat center / contain;
}
.games .gt-txt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.games button { color: var(--muted); }
.games button:hover { color: var(--ink); }
.games button.on { color: var(--ink); }

.market-strip {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 20px 10px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.market-strip .mut { color: var(--muted); }
.market-strip .sep { color: var(--muted); opacity: 0.5; }
.market-strip .up { color: var(--up); }
.market-strip .down { color: var(--down); }

/* ------------------------------------------------------------------ mapa */

.stage {
  display: flex;
  gap: 12px;
  margin: 0 20px 8px;
  height: calc(100vh - 218px);
  min-height: 440px;
}
#map { position: relative; flex: 1; min-height: 0; }

#movers {
  width: 252px;
  flex: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  padding: 14px 12px;
}
#movers h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
#movers .mv-win { color: var(--ink); font-weight: 600; }
#movers ol { list-style: none; display: flex; flex-direction: column; gap: 2px; }
#movers li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  cursor: pointer;
}
#movers li:hover { background: var(--panel-2); }
#movers li img, #movers .mv-ph {
  width: 26px;
  height: 36px;
  object-fit: contain;
  border-radius: var(--radius-card);
  flex: none;
}
#movers .mv-ph { background: var(--panel-2); border: 1px solid var(--hairline); }
#movers .mv-txt { min-width: 0; display: flex; flex-direction: column; }
#movers .mv-nm {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#movers .mv-set {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#movers .mv-right { margin-left: auto; text-align: right; display: flex; flex-direction: column; flex: none; }
#movers .mv-pct { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
#movers .mv-pct.up { color: var(--up); }
#movers .mv-pct.down { color: var(--down); }
#movers .mv-usd { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
#movers .mv-note { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); line-height: 1.6; margin-top: auto; }
@media (max-width: 880px) { #movers { display: none; } }

.tile {
  position: absolute;
  overflow: hidden;
  outline: 2px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 0.12s ease, opacity 0.12s ease;
}
/* hover: apaga o resto do mapa e acende o tile (feedback 30/08) */
.stage.dim .tile:not(.hov) { filter: brightness(0.38) saturate(0.55); }
.tile.hov { outline: 1px solid var(--ink); z-index: 5; }
.tile img {
  max-width: 76%;
  max-height: 72%;
  object-fit: contain;
  /* a única curva da tela: canto real de ~3mm da carta 63x88; o scan vem
     reto e os cantos carregam fundo branco de scanner, o clip corta isso */
  border-radius: var(--radius-card);
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}
.tile .pct {
  position: absolute;
  top: 4px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px 14px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}
.legend .chip { width: 10px; height: 10px; display: inline-block; }
.legend .chip.up { background: var(--up); }
.legend .chip.down { background: var(--down); }
.legend .sep { opacity: 0.5; }

/* -------------------------------------------------------------- hovercard */

#hovercard {
  position: fixed;
  z-index: 50;
  display: flex;
  gap: 14px;
  background: rgba(8, 9, 11, 0.97);
  border: 1px solid var(--hairline-2);
  padding: 14px;
  pointer-events: none;
  max-width: 360px;
}
#hovercard .hc-art {
  width: 118px;
  height: auto;
  align-self: flex-start;
  border-radius: var(--radius-card);
  flex: none;
}
#hovercard .hc-body { font-size: 12.5px; line-height: 1.55; min-width: 150px; }
#hovercard .hc-name { font-weight: 700; font-size: 14px; }
#hovercard .hc-set { color: var(--muted); margin-bottom: 6px; }
#hovercard .hc-pct {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
#hovercard .hc-pct.up { color: var(--up); }
#hovercard .hc-pct.down { color: var(--down); }
#hovercard .hc-mut { color: var(--muted); font-size: 12px; font-weight: 400; }
#hovercard .hc-line b { font-family: var(--font-mono); font-weight: 600; }
#hovercard .hc-hint {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------------------- top 100 */

.rank { padding: 26px 20px 34px; }
.rank-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.rank-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
}
.rank-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.rank-scroll { overflow-x: auto; margin-top: 14px; }
.rank-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.rank-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline-2);
}
.rank-table th.num, .rank-table td.num { text-align: right; }
.rank-table tbody tr { border-bottom: 1px solid var(--hairline); cursor: pointer; }
.rank-table tbody tr:hover { background: var(--panel); }
.rank-table td { padding: 7px 10px; font-size: 13px; }
.rank-table .r-n {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 11.5px;
  width: 40px;
}
.rank-table .r-card { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.rank-table .r-card img, .rank-table .r-ph {
  width: 24px;
  height: 33px;
  object-fit: contain;
  border-radius: var(--radius-card);
  flex: none;
}
.rank-table .r-ph { background: var(--panel-2); border: 1px solid var(--hairline); display: inline-block; }
.rank-table .r-nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-table .r-set { color: var(--muted); font-size: 12px; }
.rank-table .r-price, .rank-table .r-vol { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-table .r-vol { color: var(--muted); }
.rank-table .r-pct { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-table .r-pct .up { color: var(--up); }
.rank-table .r-pct .down { color: var(--down); }
.rank-table .mut { color: var(--muted); }

.empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 0 40px;
  line-height: 1.7;
}

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (max-width: 880px) {
  .stage { height: 62vh; min-height: 360px; }
  .filters { margin-left: 0; }
}
