/* 英雄榜六维前三勋章 beside ladder nicknames (ui/hero-medals.mjs; art in ui/hero-medal-art.mjs).
   The name cell groups the nickname with its medals, followed by the radar opener and status line.
   On wide rows the medals follow on the name line (and wrap below a very long name); on phones they get their own
   line under the name, before the status line, while the opener stays in its grid cell. An empty slot is hidden,
   so riders without medals keep the exact row they had. */
.hero-medals { display: inline-flex; flex: none; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.hero-medals[hidden] { display: none; }
@media (min-width: 721px) {
  .ladder .name-cell:has(> .hero-medals:not([hidden])) { column-gap: 8px; }
  .ladder .name-cell:has(> .hero-medals:not([hidden])) > .profile-avatar { margin-inline-end: 16px; }
  .ladder .name-cell > .hero-medals:not([hidden]) + .power-peek-btn { margin-left: 0; }
}
.hero-medal { position: relative; flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 5px; background: none; color: inherit; line-height: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
  --hm-glow: rgba(57, 255, 136, .3); }
.hero-medal[data-axis="volume"] { --hm-glow: rgba(61, 223, 134, .42); }
.hero-medal[data-axis="investment"] { --hm-glow: rgba(242, 161, 42, .4); }
.hero-medal[data-axis="burst"] { --hm-glow: rgba(85, 238, 205, .42); }
.hero-medal[data-axis="solo"] { --hm-glow: rgba(79, 156, 255, .45); }
.hero-medal[data-axis="endurance"] { --hm-glow: rgba(64, 212, 240, .4); }
.hero-medal[data-axis="days"] { --hm-glow: rgba(255, 92, 184, .42); }
/* A dark halo like the ladder text's (the rain beneath never reads as part of a medal) and the axis colour's glow. */
.hero-medal svg { display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none;
  filter: drop-shadow(0 0 1px var(--bg)) drop-shadow(0 0 3px var(--hm-glow)); }
.hero-medal:hover svg, .hero-medal[aria-describedby~="ui-tip"] svg { filter: drop-shadow(0 0 1px var(--bg)) drop-shadow(0 0 5px var(--hm-glow)) brightness(1.12); }
/* The medal whose tip is open keeps a quiet ring, so the tip reads as its own. */
.hero-medal[aria-describedby~="ui-tip"] { box-shadow: 0 0 0 1px var(--line); background: rgba(57, 255, 136, .06); }
.hero-medal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* An older snapshot (refresh failed or pending) stays readable but quieter; its tip says so with the original time. */
.hero-medals[data-stale] .hero-medal svg { opacity: .62; filter: drop-shadow(0 0 1px var(--bg)); }

/* Heroes (heroes-power.mjs): the name button and its medals share one wrapping line in the leaders, the ranking
   and the unranked list, so a long name keeps its ellipsis and the medals move under the name (never under the
   avatar); the profile puts them on their own line under the heading. No medals: the hidden slot takes no room. */
.pw-name-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; max-width: 100%; }
.pw-unranked-list .pw-name-line { flex: 1; }
.pw-unranked-list .pw-name-line > .pw-name { flex: 0 1 auto; }
.pw-card-id > .hero-medals:not([hidden]) { display: flex; margin: 4px 0 0; }

@media (max-width: 720px) {
  .ladder .name-cell > .hero-medals { grid-area: 2 / 2 / 3 / 4; margin: 2px 0 1px; gap: 3px; }
  .ladder .name-cell:has(> .hero-medals:not([hidden])) .row-meta { grid-row: 3; }
  .hero-medal { width: 21px; height: 21px; }
  /* The pinned mirror's cells are 64px high (styles.css); on phones they are grid items, so a row with the medal
     line keeps 64px as its minimum and grows instead of overflowing. Rows without medals are unchanged. */
  .ladder.pin-table tr:has(.hero-medals:not([hidden])) td { height: auto; min-height: 64px; }
}
/* Narrow phones: the medal line starts at the row's text edge (as the status line does), so six fit beside the speed. */
@media (max-width: 380px) {
  .ladder .name-cell > .hero-medals { grid-column: 1 / 4; }
  .hero-medal { width: 20px; height: 20px; }
}
/* Touch: the drawn medal keeps its size (the row keeps its height); only its hit area grows, into the gaps. */
@media (pointer: coarse) {
  .hero-medal::after { content: ""; position: absolute; inset: -5px -1.5px; }
}
@media (forced-colors: active) {
  .hero-medal svg { filter: none; forced-color-adjust: none; }
  .hero-medal[aria-describedby~="ui-tip"] { outline: 1px solid Highlight; }
}
