/* TCG tab (tg-*): the player's ArenaSweats TCG collection, view only. Summary and strongest cards, collection over
   time, then every card. The cards themselves are the TCG's own (tcg-kit.css fits them in). */

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

.tg-sub {
  margin: 0 0 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--j-muted);
}

/* ---------- Summary: totals and places on the left, the five strongest cards on the right ---------- */

.tg-summary__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 18px 28px;
  align-items: center;
}

.tg-summary__facts {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.tg-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 34px;
}

.tg-power {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.tg-power b {
  font: 400 50px/0.95 var(--j-display);
  letter-spacing: 0.01em;
  color: var(--j-gold-200);
  text-shadow: 0 0 26px rgba(var(--j-gold-rgb), 0.22);
}

.tg-power span {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--j-muted);
}

.tg-standing {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
}

.tg-places {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.tg-place {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tg-place b {
  font: 400 24px/1 var(--j-display);
  color: var(--j-gold-50);
}

.tg-place small {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--j-muted);
}

.tg-stats > .j-stat {
  flex: 1 1 68px;
  min-width: 68px;
  padding: 2px 14px;
}

.tg-stats > .j-stat:first-child {
  padding-left: 0;
  border-left: 0;
}

.tg-stats .j-stat__value small {
  font-size: 0.6em;
  color: var(--j-muted);
}

.tg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.tg-best__cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

/* ---------- A card in a grid: a button around the TCG's own thumbnail ---------- */

.tg-entry {
  position: relative;
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--j-dur-fast) var(--j-ease-std);
}

.tg-entry:focus-visible {
  outline: 1px solid var(--j-gold-200);
  outline-offset: 3px;
}

@media (hover: hover) {
  .tg-entry:hover { transform: translateY(-4px); }
}

.tg-entry__copies {
  position: absolute;
  top: 6%;
  right: -4px;
  z-index: 2;
  padding: 2px 7px 1px;
  border: 1px solid rgba(var(--j-gold-rgb), 0.55);
  border-radius: var(--j-radius-sm);
  background: rgba(var(--j-ink-rgb), 0.92);
  font: 400 13px/1.2 var(--j-display);
  color: var(--j-gold-100);
}

/* ---------- Collection over time ---------- */

.tg-history__chart {
  height: 300px;
}

.tg-history__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
  margin-top: 4px;
}

.tg-history__caption {
  margin: 0;
  font-size: 13px;
  color: var(--j-text-2);
}

.tg-history__caption b {
  font: 400 15px/1 var(--j-display);
  color: var(--j-gold-100);
}

/* ---------- Collection: filters and the card grid ---------- */

.tg-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 16px;
}

.tg-search {
  position: relative;
  display: inline-flex;
  flex: 1 1 180px;
  max-width: 280px;
  margin-left: auto;
}

.tg-search .j-i {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  color: var(--j-gold-300);
  pointer-events: none;
}

.tg-search input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--j-line-control);
  border-radius: var(--j-radius-sm);
  background: rgba(var(--j-ink-rgb), 0.6);
  color: var(--j-gold-50);
  font: 400 13px/1 var(--j-sans);
}

.tg-search input::placeholder { color: var(--j-dim); }

.tg-search input:hover,
.tg-search input:focus {
  border-color: var(--j-gold-300);
  outline: none;
}

.tg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 18px 14px;
  align-items: start;
}

/* Batches (tabs/tcg.js) are only loading groups: their cards sit straight in the grid. */
.tg-batch {
  display: contents;
}

.tg-grid > .j-empty {
  grid-column: 1 / -1;
}

.tg-more {
  display: flex;
  justify-content: center;
  min-height: 24px;
  margin-top: 14px;
}

.tg-more__failed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  font-size: 13px;
  color: var(--j-text-2);
}

@media (max-width: 1100px) {
  .tg-summary__body { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .tg-best__cards { gap: 6px; }
  .tg-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px 8px; }
  .tg-history__chart { height: 240px; }
  .tg-search { max-width: none; margin-left: 0; }
}
