/* TrenchTV card graphics added on top of style.css: rug radar, graduation race,
   heatmap, market dashboard, donut and horizontal bars (built by charts.js). */

/* ---------- shared gauge ---------- */
.g-num { font-family: var(--display); font-size: 46px; }

/* ---------- checklist (rug radar) ---------- */
.rr { position: absolute; inset: 0; display: flex; gap: 28px; align-items: stretch; }
.rr-meter { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px 14px; border-radius: 14px; background: var(--panel-2); }
.rr-cap { font-family: var(--mono); font-size: 15px; letter-spacing: 2px; color: var(--muted); }
.rr-gauge { width: 100%; height: auto; display: block; min-height: 0; flex: 0 1 auto; }
.rr-gauge .g-num { font-size: 50px; }
.rr-level { padding: 6px 16px; border-radius: 8px; font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: 1px; color: var(--on-neon); white-space: nowrap; }
.rr-list { flex: 1; min-width: 0; list-style: none; display: grid; gap: 8px; align-content: center; }
.rr-item { min-height: 0; display: flex; align-items: center; gap: 14px; padding: 0 18px 0 12px; border-radius: 12px; background: var(--panel-2); animation: ttv-slide-in 0.4s ease-out both; }
.rr-item.bad { background: rgba(255,107,120,0.1); outline: 1px solid rgba(255,107,120,0.35); }
.rr-ic { flex: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 20px; font-weight: 700; line-height: 1; }
.rr-item.ok .rr-ic { background: var(--up); color: var(--on-neon); }
.rr-item.bad .rr-ic { background: var(--down); color: #1a0306; }
.rr-item.unk .rr-ic { border: 2px solid var(--faint); color: var(--muted); }
.rr-lab { flex: 1; min-width: 0; font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-val { flex: none; max-width: 50%; font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-item.ok .rr-val { color: var(--up); }
.rr-item.bad .rr-val { color: var(--down); }
.rr-item.unk .rr-val { color: var(--muted); }

.rr.compact .rr-list { gap: 6px; }
.rr.compact .rr-item { gap: 12px; }
.rr.compact .rr-ic { width: 26px; height: 26px; font-size: 17px; }
.rr.compact .rr-lab { font-size: 19px; }
.rr.compact .rr-val { font-size: 18px; }

/* ---------- race (graduation race) ---------- */
.race { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.race-head, .race-row { display: grid; grid-template-columns: 34px minmax(0, 252px) minmax(0, 1fr) 96px; column-gap: 18px; align-items: center; }
.race-head { font-family: var(--mono); font-size: 15px; letter-spacing: 1px; color: var(--muted); }
.race-head span:last-child, .race-pct { text-align: right; }
.race-goal { justify-self: end; margin-right: -6px; padding: 2px 10px; border-radius: 4px; color: var(--text); font-weight: 700; background: repeating-conic-gradient(rgba(238,245,238,0.16) 0 25%, transparent 0 50%) 0 0 / 12px 12px; }
.race-row { flex: 1; min-height: 0; max-height: 62px; border-bottom: 1px dashed rgba(159,179,163,0.18); }
.race-row:last-child { border-bottom: 0; }
.race-pos { font-family: var(--display); font-size: 26px; text-align: center; color: var(--muted); }
/* token pictures (filtered logos); the neutral coin shows when there is no safe image */
.tok-ic { position: relative; flex: none; display: inline-block; width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #2c4a35, #0f1d14 70%); box-shadow: inset 0 0 0 2px rgba(124,255,107,0.35); }
.tok-ic::after { content: ""; position: absolute; inset: 28%; border-radius: 50%; border: 2px solid rgba(124,255,107,0.35); }
.tok-ic img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; background: #0b140e; }
.tok-ic.md { width: 40px; height: 40px; }
.tok-ic.sm { width: 34px; height: 34px; }
.tok-ic.tm { box-shadow: 0 2px 10px rgba(0,0,0,0.45), inset 0 0 0 2px rgba(255,255,255,0.25); margin-bottom: 4px; }
.race-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.race.compact .tok-ic.md { width: 32px; height: 32px; }
.hb-lab.tok { display: flex; align-items: center; gap: 10px; }
.hb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.race-nm { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.race-nm b { font-weight: 800; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-nm small { font-family: var(--mono); font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-nm em { font-style: normal; }
.race-lane {
  position: relative; height: 20px; border-radius: 10px;
  background:
    linear-gradient(90deg, transparent calc(25% - 1px), var(--grid) 0 25%, transparent 0 calc(50% - 1px), var(--grid) 0 50%, transparent 0 calc(75% - 1px), var(--grid) 0 75%, transparent 0),
    rgba(159,179,163,0.1);
}
/* finish line: checkered strip at 100% */
.race-lane::after { content: ""; position: absolute; right: -6px; top: -10px; bottom: -10px; width: 12px; border-radius: 2px; background: repeating-conic-gradient(var(--text) 0 25%, #07100b 0 50%) 0 0 / 12px 12px; opacity: 0.85; }
.race-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; background: linear-gradient(90deg, rgba(47,212,196,0.25), var(--teal)); animation: ttv-grow-w 1s cubic-bezier(.2,.8,.2,1) both; }
.race-dot { position: absolute; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; background: var(--teal); border: 4px solid var(--bg); z-index: 1; animation: ttv-run 1s cubic-bezier(.2,.8,.2,1) both; }
.race-pct { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--text); }
.race-row.lead .race-pos, .race-row.lead .race-nm b, .race-row.lead .race-pct { color: var(--neon); }
.race-row.lead .race-fill { background: linear-gradient(90deg, rgba(124,255,107,0.25), var(--neon)); }
.race-row.lead .race-dot { background: var(--neon); box-shadow: 0 0 0 6px rgba(124,255,107,0.22), 0 0 22px rgba(124,255,107,0.6); }

.race.compact { gap: 4px; }
.race.compact .race-nm b { font-size: 20px; line-height: 1.15; }
.race.compact .race-nm small { line-height: 1.15; }
.race.compact .race-pct { font-size: 22px; }

/* ---------- treemap (heatmap) ---------- */
.tm { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; }
.tm-map { position: relative; flex: none; overflow: hidden; }
.tm-tile { position: absolute; overflow: hidden; border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 2px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.55); animation: ttv-pop 0.45s ease-out both; }
.tm-lab { max-width: 100%; font-weight: 800; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-chg { max-width: 100%; font-family: var(--mono); font-weight: 700; white-space: nowrap; overflow: hidden; }
.tm-legend { flex: none; height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-family: var(--mono); font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.tm-legend > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.tm-scale { flex: none; display: flex; align-items: center; gap: 10px; }
.tm-scale i { width: 160px; height: 12px; border-radius: 3px; }
.tm-scale small { font-size: 15px; }

/* ---------- dashboard (market block) ---------- */
.db { position: absolute; inset: 0; display: grid; gap: 12px; }
.db-tile { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border-radius: 12px; background: var(--panel-2); animation: ttv-pop 0.45s ease-out both; }
.db-lab { flex: none; font-family: var(--mono); font-size: 15px; letter-spacing: 1px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-val { flex: none; font-family: var(--mono); font-size: 34px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-val.long { font-size: 28px; }
.db-sub { font-family: var(--mono); font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-k-stat { justify-content: center; }
.db-k-stat .db-lab { margin-bottom: 2px; }
.db-body { flex: 1; min-height: 0; display: flex; align-items: center; gap: 14px; }
.db-gauge { flex: none; display: block; }
.db-gauge .g-num { font-size: 48px; }
.db-word { flex: 1; min-width: 0; font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.db-chart { flex: 1; min-height: 20px; position: relative; }
.db-spark { position: absolute; inset: 0; width: 100%; height: 100%; }
.db.compact .db-tile { padding: 10px 16px; gap: 2px; }
.db.compact .db-val { font-size: 30px; }
.db.compact .db-val.long { font-size: 24px; }

/* ---------- donut (shares) ---------- */
.dn { position: absolute; inset: 0; display: flex; align-items: center; gap: 40px; }
.dn-ring { position: relative; flex: none; }
.dn-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dn-ring svg { animation: ttv-spin-in 0.8s cubic-bezier(.2,.8,.2,1) both; }
.dn-mid { position: absolute; inset: 22%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; overflow: hidden; }
.dn-mid b { max-width: 100%; font-family: var(--display); font-weight: 400; line-height: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dn-mid small { max-width: 100%; font-family: var(--mono); font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dn-legend { flex: 1; min-width: 0; align-self: stretch; list-style: none; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.dn-legend li { flex: 0 1 50px; min-height: 0; display: flex; align-items: center; gap: 14px; padding: 0 16px; border-radius: 10px; background: var(--panel-2); animation: ttv-slide-in 0.4s ease-out both; }
.dn-legend li.first { background: rgba(124,255,107,0.1); outline: 1px solid rgba(124,255,107,0.35); }
.dn-legend i { flex: none; width: 16px; height: 16px; border-radius: 4px; }
.dn-lab { flex: 1; min-width: 0; font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dn-amt { flex: none; font-family: var(--mono); font-size: 16px; color: var(--muted); }
.dn-pct { flex: none; min-width: 72px; text-align: right; font-family: var(--mono); font-size: 22px; font-weight: 700; }
.dn-legend li.first .dn-pct { color: var(--neon); }

/* ---------- hbars ---------- */
.hb { position: absolute; inset: 0; display: grid; grid-template-columns: fit-content(300px) minmax(0, 1fr) max-content; column-gap: 20px; row-gap: 8px; align-items: center; align-content: center; }
.hb-lab { min-width: 0; font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { position: relative; height: 70%; max-height: 34px; min-height: 14px; border-radius: 6px; background: rgba(159,179,163,0.1); overflow: hidden; }
.hb-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; animation: ttv-grow-w 0.9s cubic-bezier(.2,.8,.2,1) both; }
.hb-txt { font-family: var(--mono); font-size: 22px; font-weight: 700; text-align: right; white-space: nowrap; }

/* ---------- entry animations ---------- */
@keyframes ttv-grow-w { from { width: 0; } }
@keyframes ttv-run { from { left: 0; } }
@keyframes ttv-pop { from { opacity: 0; transform: scale(0.94); } }
@keyframes ttv-slide-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes ttv-spin-in { from { opacity: 0; transform: rotate(-40deg); } }
@media (prefers-reduced-motion: reduce) {
  .rr-item, .race-fill, .race-dot, .tm-tile, .db-tile, .dn-ring svg, .dn-legend li, .hb-track i { animation: none !important; }
}
