.hero-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.hero-toolbar h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.hero-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  gap: 8px;
}

.hero-actions button {
  width: auto;
  min-width: 58px;
  margin: 0;
}

.hero-active-list {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 0 9px;
}

.active-hero,
.active-empty {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  padding: 6px 8px;
  color: #f7e7b8;
  background: rgba(19, 28, 28, .78);
  font-size: 11px;
  font-weight: 900;
}

.active-empty {
  color: var(--muted);
}

.hero-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hero-empty {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: rgba(13, 22, 23, .72);
}

.hero-card {
  position: relative;
  min-height: 232px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(18, 27, 29, .94);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .25);
}

.hero-card.selected {
  border-color: rgba(244, 210, 96, .9);
  box-shadow: 0 0 0 2px rgba(244, 210, 96, .18), 0 12px 26px rgba(0, 0, 0, .35);
}

.hero-portrait {
  position: relative;
  height: 132px;
  overflow: hidden;
  background: rgba(0, 0, 0, .28);
}

.hero-card-img,
.hero-effect-img {
  position: absolute;
  inset: 0;
  width: calc(var(--card-frames, 2) * 100%);
  height: 100%;
  max-width: none;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  animation: heroCardFrames calc(.82s + var(--card-frames, 2) * .12s) steps(var(--card-frames, 2)) infinite;
}

.hero-effect-img {
  width: calc(var(--effect-frames, var(--card-frames, 2)) * 100%);
  opacity: .78;
  mix-blend-mode: screen;
  animation-duration: calc(.62s + var(--card-frames, 2) * .08s);
  animation-name: heroEffectFrames;
  animation-timing-function: steps(var(--effect-frames, var(--card-frames, 2)));
}

.hero-portrait b {
  position: absolute;
  right: 7px;
  top: 7px;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 7px;
  padding: 4px 6px;
  color: #1b1710;
  background: #f5d66f;
  font-size: 11px;
  font-weight: 1000;
}

.hero-info {
  padding: 8px;
}

.hero-info h3 {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 0 0 5px;
  font-size: 14px;
  line-height: 1.2;
}

.hero-info h3 span {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 11px;
}

.hero-info p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 7px;
}

.hero-stats span {
  border-radius: 6px;
  padding: 4px 2px;
  color: #f2e5bd;
  background: rgba(255, 255, 255, .07);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.rarity-R { --rarity-glow: rgba(188, 220, 210, .28); }
.rarity-SR { --rarity-glow: rgba(95, 188, 255, .36); }
.rarity-SSR { --rarity-glow: rgba(220, 122, 255, .42); }
.rarity-UR { --rarity-glow: rgba(255, 214, 82, .5); }

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 34px var(--rarity-glow);
}

.hero-draw-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 5, 9, .82);
}

.hero-draw-overlay.hidden {
  display: none;
}

.hero-draw-result {
  position: relative;
  width: min(280px, 80vw);
  min-height: 360px;
  display: grid;
  align-content: end;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  padding: 18px;
  overflow: hidden;
  color: #fff3c8;
  text-align: center;
  background: rgba(16, 23, 28, .96);
  box-shadow: 0 0 48px var(--rarity-glow), 0 20px 60px rgba(0, 0, 0, .62);
}

.hero-draw-result img {
  position: absolute;
  inset: 0;
  width: calc(var(--card-frames, 2) * 100%);
  height: 100%;
  max-width: none;
  object-fit: fill;
  animation: heroDrawCard calc(.7s + var(--card-frames, 2) * .06s) steps(var(--card-frames, 2)) infinite;
}

.hero-draw-result strong,
.hero-draw-result span {
  position: relative;
  z-index: 3;
  text-shadow: 0 2px 5px rgba(0, 0, 0, .8);
}

.hero-draw-result strong {
  font-size: 19px;
}

.hero-draw-result span {
  font-size: 12px;
}

.draw-burst {
  position: absolute;
  inset: -10%;
  z-index: 2;
  background: url("../assets/heroes/effects/draw-burst-sheet.png?v=20260619a") left center / 400% 100% no-repeat;
  mix-blend-mode: screen;
  animation: drawBurst .62s steps(4) infinite;
}

.realm-guard-heroes {
  display: none;
}

.realm-guard-heroes span {
  position: relative;
  width: 26px;
  height: 26px;
  overflow: hidden;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .7)) drop-shadow(0 0 5px rgba(255, 92, 84, .62));
}

.guard-hero-unit,
.guard-hero-strike {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  max-width: none;
  object-fit: fill;
  pointer-events: none;
}

.guard-hero-unit {
  width: 100%;
  height: 400%;
  animation: heroGuardFrame .55s infinite;
}

.guard-hero-strike {
  z-index: 2;
  width: 600%;
  height: 100%;
  opacity: .82;
  mix-blend-mode: screen;
  animation: heroGuardStrike .48s infinite;
}

@keyframes heroCardFrames {
  from { transform: translateX(0); }
  to { transform: translateX(calc((1 - var(--card-frames, 2)) * 100% / var(--card-frames, 2))); }
}

@keyframes heroEffectFrames {
  from { transform: translateX(0); }
  to { transform: translateX(calc((1 - var(--effect-frames, var(--card-frames, 2))) * 100% / var(--effect-frames, var(--card-frames, 2)))); }
}

@keyframes heroDrawCard {
  from { transform: translateX(0) scale(.96); }
  to { transform: translateX(calc((1 - var(--card-frames, 2)) * 100% / var(--card-frames, 2))) scale(1); }
}

@keyframes drawBurst {
  from { background-position-x: 0; }
  to { background-position-x: 100%; }
}

@keyframes heroGuardFrame {
  0%, 24.99% { transform: translateY(0); }
  25%, 49.99% { transform: translateY(-25%); }
  50%, 74.99% { transform: translateY(-50%); }
  75%, 100% { transform: translateY(-75%); }
}

@keyframes heroGuardStrike {
  0%, 16.66% { transform: translateX(0); }
  16.67%, 33.32% { transform: translateX(-16.666%); }
  33.33%, 49.99% { transform: translateX(-33.333%); }
  50%, 66.65% { transform: translateX(-50%); }
  66.66%, 83.32% { transform: translateX(-66.666%); }
  83.33%, 100% { transform: translateX(-83.333%); }
}
