/* Enemy sprite display */
.enemy-sprite-wrapper {
  position: relative;
  display: inline-block;
  align-self: flex-end;
}

.enemy-sprite {
  width: 250px;
  height: 250px;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: visible;
  position: relative;

  filter:
    drop-shadow(1px 0 0 #000) drop-shadow(-1px 0 0 #000) drop-shadow(0 1px 0 #000) drop-shadow(0 -1px 0 #000) drop-shadow(0 0 4px rgba(0, 0, 0, 0.6));
}

.enemy-sprite.action-lunge-left {
  animation: lunge-left 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10001;
  border-color: transparent;
  box-shadow: none;
}

.enemy-sprite.action-stunned {
  animation: lunge-down 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10001;
  border-color: transparent;
  box-shadow: none;
}

.enemy-sprite.has-floating-numbers {
  z-index: 999;
}

.enemy-sprite.dead {
  opacity: 0.85;
}

.enemy-sprite.dead img {
  filter: grayscale(100%);
}

.enemy-sprite img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.enemy-sprite:hover {
  opacity: 0.9;
}

/* Enemy size variants */
.enemy-sprite-small {
  width: 150px;
  height: 150px;
}

.enemy-sprite-medium {
  width: 200px;
  height: 200px;
}

.enemy-sprite-large {
  width: 250px;
  height: 250px;
}

.enemy-sprite-miniboss {
  width: 300px;
  height: 300px;
}

.enemy-sprite-boss {
  width: 400px;
  height: 400px;
}

.enemy-sprite-bars {
  margin-top: 8px;
  width: 100%;
}

.enemy-sprite-bars .stat-bar {
  margin-bottom: 6px;
  position: relative;
}

.enemy-sprite-bars .progress-bar-bg {
  margin-bottom: 6px;
  position: relative;
}

.enemy-sprite-bars .bar-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
  color: #ffffff;
  pointer-events: none;
  z-index: 1;
}

/* Enemy sprite buffs */
.enemy-sprite-buffs {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
}

/* Hover card overlay */
.enemy-sprite-hover-card {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
  min-width: 320px;
}

.enemy-sprite-wrapper:hover .enemy-sprite-hover-card {
  opacity: 1;
  pointer-events: auto;
}

/* Ensure hover card unit doesn't have normal unit-card hover effects */
.enemy-sprite-hover-card .unit-card {
  pointer-events: none;
}

.unit-card.enemy {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
  border-color: #dc2626;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4), 0 0 20px rgba(220, 38, 38, 0.3);
  color: #ffffff;
}

.unit-card.dead {
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  border-color: #4a4a4a;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  opacity: 0.85;
  filter: grayscale(100%);
  color: #9ca3af;
}

.unit-card.draggable {
  cursor: grab;
}

.unit-card.draggable:active {
  cursor: grabbing;
}

/* === Horizontal Unit Card Layout === */
.unit-card-horizontal {
  display: flex;
  flex-direction: row;
  width: fit-content !important;
  min-width: unset !important;
  max-width: unset !important;
  height: auto;
  padding: 10px 12px;
  gap: 4px;
  align-items: start;
  overflow: visible;
}

.unit-card-horizontal .disclosure {
  display: none;
}

.disclosure-horizontal {
  font-size: 10px;
  padding: 2px 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(139, 90, 43, 0.8);
  transition: all 0.2s ease;
  box-shadow: none !important;
}

.disclosure-horizontal:hover {
  color: rgba(139, 90, 43, 1);
  transform: scale(1.2);
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.unit-card-horizontal .unit-header {
  grid-column: 1;
  grid-row: 1 / 3;
  margin-bottom: 0;
  flex-direction: column;
  gap: 6px;
  width: auto;
  flex-shrink: 0;
}

/* Portrait and name section - compact */
.unit-card-horizontal .unit-header>div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Stat bars next to portrait */
.unit-card-horizontal>.stat-bar:nth-of-type(1) {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
}

.unit-card-horizontal>.stat-bar:nth-of-type(2) {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
}

.unit-card-horizontal .unit-avatar-shrink,
.unit-card-horizontal>.unit-header>div:first-child {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
}

.unit-card-horizontal .unit-header img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: 2px solid rgba(139, 90, 43, 0.6);
  border-radius: 6px;
}

.unit-card-horizontal .unit-name {
  font-size: 14px;
  line-height: 1.2;
}

.unit-card-horizontal .unit-subtitle {
  font-size: 11px;
}

.unit-card-horizontal .stat-bar {
  width: 160px;
  height: 18px;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.unit-card-horizontal .stat-label {
  font-size: 10px;
  padding: 0 4px;
}

.unit-card-horizontal .progress-bar-bg {
  height: 14px;
}

.unit-card-horizontal .stats-grid {
  display: flex;
  flex-direction: row;
  gap: 4px;
  width: auto;
  padding: 0;
  margin-top: 0;
  flex-shrink: 0;
}

.unit-card-horizontal .stat-item {
  font-size: 11px;
  padding: 4px 6px;
  min-width: 60px;
}

.unit-card-horizontal .inventory-compact {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  padding: 0;
  margin-top: 0;
}

.unit-card-horizontal .inventory-icon-wrapper {
  width: 24px;
  height: 24px;
}

.unit-card-horizontal .inventory-icon {
  font-size: 14px;
}

.unit-card-horizontal .spell-icon-compact {
  font-size: 16px;
}

.unit-card-horizontal .spell-cooldown-number,
.unit-card-horizontal .buff-stack-count {
  font-size: 9px;
}

.unit-card-horizontal .unit-stats-container {
  position: static;
  transform: none;
  margin-top: 0;
}

.unit-card-horizontal .unit-stat {
  padding: 3px 6px;
  font-size: 10px;
}

.unit-card-horizontal .unit-stat-value {
  font-size: 12px;
}

.unit-card-horizontal .unit-stat-label {
  font-size: 8px;
}

.unit-card-horizontal .floating-number {
  top: -30px;
}

/* Show inventory and equipment in horizontal mode */
.unit-card-horizontal .inventory-section,
.unit-card-horizontal .equipment-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  width: fit-content !important;
  min-width: unset !important;
  margin-top: 0 !important;
}

.unit-card-horizontal .equipment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 250px;
}

.unit-card-horizontal .inventory-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 250px;
}

.unit-card-horizontal .inventory-icon-wrapper,
.unit-card-horizontal .equipment-slot {
  flex-shrink: 0;
}

/* Center tooltips in horizontal layout */
.unit-card-horizontal .inventory-tooltip {
  left: 50% !important;
  transform: translateX(-50%) translateY(-8px) !important;
}

.unit-card-horizontal .inventory-icon-wrapper:hover .inventory-tooltip {
  transform: translateX(-50%) translateY(-12px) !important;
}

/* Position comparison tooltip for horizontal layout */
.unit-card-horizontal .inventory-comparison-tooltip {
  left: 50% !important;
  transform: translateX(calc(-50% + 280px)) translateY(-8px) !important;
  bottom: 100%;
}

.unit-card-horizontal .inventory-icon-wrapper:hover .inventory-comparison-tooltip {
  transform: translateX(calc(-50% + 280px)) translateY(-12px) !important;
}

.unit-card-horizontal .comparison-tooltip-content .inventory-tooltip {
  left: 0 !important;
  transform: none !important;
  position: relative;
}

/* Center stat tooltips in horizontal layout */
.unit-card-horizontal .stat-tooltip {
  left: 50% !important;
  transform: translateX(-50%) translateY(-8px) !important;
}

.unit-card-horizontal .stat-tooltip-wrapper:hover .stat-tooltip {
  opacity: 1 !important;
  transform: translateX(-50%) translateY(-12px) !important;
}

/* Rarity glows for horizontal layout inventory */
.unit-card-horizontal .equipment-slot.rarity-magic,
.unit-card-horizontal .relic-slot.rarity-magic,
.unit-card-horizontal .inventory-icon-wrapper.rarity-magic {
  background: radial-gradient(circle at center, var(--rarity-magic), rgba(0, 0, 0, 0.3)) !important;
}

.unit-card-horizontal .equipment-slot.rarity-epic,
.unit-card-horizontal .relic-slot.rarity-epic,
.unit-card-horizontal .inventory-icon-wrapper.rarity-epic {
  background: radial-gradient(circle at center, var(--rarity-epic), rgba(0, 0, 0, 0.3)) !important;
}

.unit-card-horizontal .equipment-slot.rarity-legendary,
.unit-card-horizontal .relic-slot.rarity-legendary,
.unit-card-horizontal .inventory-icon-wrapper.rarity-legendary {
  background: radial-gradient(circle at center, var(--rarity-legendary), rgba(0, 0, 0, 0.3)) !important;
}

.unit-card-horizontal .equipment-slot.rarity-unique,
.unit-card-horizontal .relic-slot.rarity-unique,
.unit-card-horizontal .inventory-icon-wrapper.rarity-unique {
  background: radial-gradient(circle at center, var(--rarity-unique), rgba(0, 0, 0, 0.3)) !important;
}

.unit-card-horizontal .equipment-slot.rarity-mythic,
.unit-card-horizontal .relic-slot.rarity-mythic,
.unit-card-horizontal .inventory-icon-wrapper.rarity-mythic {
  background: radial-gradient(circle at center, var(--rarity-mythic), rgba(0, 0, 0, 0.3)) !important;
}

/* === Horizontal Party Tray === */
.party-horizontal-tray {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px 20px;
  background: linear-gradient(to top,
      rgba(15, 10, 5, 0.96) 0%,
      rgba(15, 10, 5, 0.88) 60%,
      rgba(15, 10, 5, 0.65) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.7);
  border-top: 2px solid rgba(139, 90, 43, 0.5);
}

/* Flex layout for horizontal mode */
#dungeon.layout-horizontal {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  overflow: hidden;
}

/* Push combat area down when horizontal tray is active - but not for event screens */
#dungeon.layout-horizontal:not(:has(.event-card-parchment)) .inner {
  margin-top: 300px;
}

/* Center event card in horizontal layout */
#dungeon.layout-horizontal:has(.event-card-parchment) {
  justify-content: center;
  overflow: hidden;
}

#dungeon.layout-horizontal:has(.event-card-parchment) .inner {
  margin-top: 0;
  padding-bottom: 240px;
}

/* Align combatants to bottom in horizontal layout */
#dungeon.layout-horizontal .combatants {
  display: flex;
  align-items: flex-end;
}

/* Hero portrait wrapper and bars */
.hero-portrait-wrapper {
  display: inline-block;
}

.hero-portrait-bars {
  margin-top: 8px;
  width: 250px;
}

/* Hero sprite image styling */
.hero-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  filter: drop-shadow(1px 0 0 #000) drop-shadow(-1px 0 0 #000) drop-shadow(0 1px 0 #000) drop-shadow(0 -1px 0 #000) drop-shadow(0 0 4px rgba(0, 0, 0, 0.6));
}

.hero-portrait-bars .stat-bar {
  margin-bottom: 6px;
  position: relative;
}

.hero-portrait-bars .progress-bar-bg {
  margin-bottom: 6px;
  position: relative;
}

.hero-portrait-bars .bar-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
  color: #ffffff;
  pointer-events: none;
  z-index: 1;
}

/* Hero portrait animations in horizontal layout */
.hero-portrait {
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: visible !important;
}

.hero-portrait.dead {
  opacity: 0.85;
}

.hero-portrait.dead img {
  filter: grayscale(100%);
  transform: rotate(-90deg) translateX(-30px);
  transform-origin: center center;
}

.hero-portrait.action-lunge-right {
  animation: lunge-right 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10001;
  border: none !important;
}

.hero-portrait.action-stunned {
  animation: lunge-down 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 15px #9333ea !important;
  z-index: 10001;
  border-color: #9333ea !important;
}

.hero-portrait.has-floating-numbers {
  z-index: 999;
}

/* Floating numbers on hero portraits */
.hero-portrait .floating-number {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 32px;
  font-weight: bold;
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.9),
    -1px -1px 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 10002;
  animation: float-up 3s ease-out forwards;
}

.hero-portrait .floating-number.floating-damage {
  color: #ff6b6b;
}

.hero-portrait .floating-number.floating-crit {
  color: #ffd700;
}

.hero-portrait .floating-number.floating-ult {
  color: #00ffff;
}

.hero-portrait .floating-number.floating-heal {
  color: #4ade80;
}

/* Disable animations on horizontal unit cards during combat */
#dungeon.layout-horizontal .party-horizontal-tray .unit-card-horizontal.action-lunge-right,
#dungeon.layout-horizontal .party-horizontal-tray .unit-card-horizontal.action-stunned {
  animation: none !important;
  box-shadow: none !important;
}

/* Hide floating numbers on horizontal unit cards */
#dungeon.layout-horizontal .party-horizontal-tray .unit-card-horizontal .floating-number {
  display: none;
}

.party-horizontal-tray #party {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Centered variant for town (no enemies) */
.party-horizontal-tray-centered #party {
  justify-content: center;
}

/* Hero sprites in town horizontal mode */
.hero-sprite-wrapper-town {
  display: inline-block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.party-horizontal-tray .party-member-group {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.party-horizontal-tray .minions-container {
  flex-direction: row;
  margin-top: 0;
  margin-left: 0;
  gap: 4px;
}

.party-horizontal-tray .minions-drop-zone-empty {
  display: none;
}

/* Adjust minion cards in horizontal tray */
.party-horizontal-tray .tavern-minion-card-small {
  width: 50px;
  padding: 4px;
}

.party-horizontal-tray .tavern-minion-portrait-small {
  width: 42px;
  height: 42px;
}

.party-horizontal-tray .minion-bars-container {
  height: auto;
}

.unit-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 20px;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.5);
}

.unit-card-modal .unit-header {
  align-items: baseline;
}

.unit-card.enemy .unit-header {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.unit-card.dead .unit-header {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.unit-header img {
  object-fit: cover;
  display: block;
  padding: 0;
  image-rendering: pixelated;
}

.unit-card.enemy .unit-header img {
  border-color: rgba(220, 38, 38, 0.8);
}

.unit-card.dead .unit-header img {
  border-color: #4a4a4a;
}

.unit-name {
  cursor: text;
  padding: 0;
  border-radius: 4px;
  transition: background 0.2s ease;
  outline: none;
  text-align: start;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* Prevent wrapping for enemy and dead unit names */
.unit-card.enemy .unit-name,
.unit-card.dead .unit-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dynamic font scaling for long names */
.unit-name.name-long {
  font-size: 0.75em;
}

.unit-name.name-very-long {
  font-size: 0.65em;
}

.unit-name.name-extremely-long {
  font-size: 0.55em;
  line-height: 1.2;
}

.unit-card-modal .unit-name {
  cursor: text !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  max-width: 450px;
  display: block;
}

.unit-name-editable:hover {
  background: rgba(139, 90, 43, 0.2);
}

.unit-name-editable:focus {
  background: rgba(139, 90, 43, 0.3);
  box-shadow: 0 0 0 2px rgba(139, 90, 43, 0.6);
}

.unit-card.enemy .unit-name-editable:hover,
.unit-card.dead .unit-name-editable:hover {
  background: rgba(255, 255, 255, 0.1);
}

.unit-card.enemy .unit-name-editable:focus,
.unit-card.dead .unit-name-editable:focus {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.unit-emoji {
  font-size: 64px;
  padding: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.unit-subtitle {
  font-size: 12px;
  color: #6b4423;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.unit-card.enemy .unit-subtitle,
.unit-card.dead .unit-subtitle {
  color: #cbd5e1;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.warrior .unit-subtitle,
.warrior .tavern-hero-class {
  color: #1e40af;
}

.rogue .unit-subtitle,
.rogue .tavern-hero-class {
  color: #ca8a04;
}

.mage .unit-subtitle,
.mage .tavern-hero-class {
  color: #7e22ce;
}

.stat-bar {
  margin-bottom: 8px;
  width: 100%;
  max-width: 220px;
}

.stat-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
  font-weight: 600;
  color: #5d4037;
}

.unit-card.enemy .stat-label,
.unit-card.dead .stat-label {
  color: #cbd5e1;
}

.progress-bar-bg {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.3);
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.progress-bar {
  height: 100%;
  transition: width 0.3s ease;
}

.hp-bar.high {
  background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

.hp-bar.medium {
  background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

.hp-bar.low {
  background: linear-gradient(90deg, #f87171 0%, #ef4444 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

.energy-bar {
  background: linear-gradient(90deg, rgb(7, 255, 255) 0%, rgb(0, 150, 150) 100%);
}

.energy-bar.full {
  background: linear-gradient(90deg, rgb(7, 255, 255) 0%, rgb(0, 150, 150) 100%);
  animation: pulse 1s ease-in-out infinite;
}

.shield-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.7) 0%, rgba(37, 99, 235, 0.7) 100%);
  border-right: 2px solid rgba(96, 165, 250, 0.9);
  transition: width 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(147, 197, 253, 0.5);
  pointer-events: none;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.stat-item {
  text-align: center;
  font-size: 12px;
  color: #5d4037;
}

.unit-card.enemy .stat-item,
.unit-card.dead .stat-item {
  color: #cbd5e1;
}

.stat-tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.stat-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-radius: 6px;
  padding: 6px 10px;
  min-width: 180px;
  max-width: 350px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 8px rgba(59, 130, 246, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  white-space: nowrap;
}

.stat-tooltip-wrapper:hover .stat-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}

.stat-tooltip-below {
  bottom: auto;
  top: 100%;
  transform: translateX(-50%) translateY(8px);
}

.stat-tooltip-wrapper:hover .stat-tooltip-below {
  transform: translateX(-50%) translateY(12px);
}

.stat-tooltip-left-align {
  left: 0;
  transform: translateY(-8px);
}

.stat-tooltip-wrapper:hover .stat-tooltip-left-align {
  transform: translateY(-12px);
}

.stat-tooltip-left-align.stat-tooltip-below {
  transform: translateY(8px);
}

.stat-tooltip-wrapper:hover .stat-tooltip-left-align.stat-tooltip-below {
  transform: translateY(12px);
}

.stat-tooltip-follow-mouse {
  left: var(--mouse-x, 0) !important;
  transform: translateY(-8px) !important;
}

.stat-tooltip-wrapper:hover .stat-tooltip-follow-mouse {
  transform: translateY(-12px) !important;
}

.stat-tooltip-follow-mouse.stat-tooltip-below {
  transform: translateY(8px) !important;
}

.stat-tooltip-wrapper:hover .stat-tooltip-follow-mouse.stat-tooltip-below {
  transform: translateY(12px) !important;
}

.stat-breakdown {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
  margin-top: 4px;
  padding-top: 6px;
}

.stat-breakdown>div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.stat-breakdown-value {
  font-weight: 700;
  color: #fbbf24;
}

.stat-breakdown-total {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
  font-weight: 700;
}

.stat-value.buff,
.stat-value.debuff {
  color: #3fbf6a;

  /* no text-stroke */
  -webkit-text-stroke: 0;

  text-shadow:
    0 0 1px rgba(43, 30, 20, 0.9),
    /* halo, not outline */
    0 1px 1px rgba(0, 0, 0, 0.25);
  /* tiny depth */
}

.buff,
.stat-value.buff,
.stat-item .buff,
.stat-label .buff {
  color: lime;
  text-shadow: 0 0 1px rgba(43, 30, 20, 0.9), 0 1px 1px rgba(0, 0, 0, 0.25)
}

/* .stat-item .buff::before {
  content: "+";
} */

.debuff,
.stat-value.debuff,
.stat-item .debuff,
.stat-label .debuff {
  color: red;
  text-shadow: 0 0 1px rgba(43, 30, 20, 0.9), 0 1px 1px rgba(0, 0, 0, 0.25)
}

/*
.stat-item .debuff::before {
  content: "−";
} */

.stat-value {
  font-size: 18px;
  font-weight: bold;
  display: block;
  margin-top: 2px;
  color: #3e2723;
}

.unit-card-modal .stat-value:not(.buff):not(.debuff) {
  color: #fff;
}

.unit-card.enemy .stat-value,
.unit-card.dead .stat-value {
  color: #ffffff;
}

.unit-gold {
  margin-top: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  color: #fbbf24;
}

/* Inventory Styles */
.inventory-section {
  margin-top: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 100% !important;
  box-sizing: border-box;
}

.unit-modal-content .inventory-section {
  min-height: 150px;
}

.inventory-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ffffff;
  margin-bottom: 8px;
  text-align: center;
  opacity: 0.9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 5px;
  transition: all 0.2s ease;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(139, 90, 43, 0.3);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.unit-card.enemy .inventory-header,
.unit-card.dead .inventory-header {
  color: #cbd5e1;
  opacity: 0.8;
}

.inventory-header.clickable {
  cursor: pointer;
  user-select: none;
}

.inventory-header.clickable:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.inventory-toggle-icon {
  font-size: 10px;
  opacity: 0.6;
}

.inventory-group-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 0;
  padding: 6px 10px;
  /* background: rgba(0, 0, 0, 0.15); */
  border-radius: 4px;
  color: #6b4423;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.unit-card.enemy .inventory-group-header,
.unit-card.dead .inventory-group-header {
  color: #cbd5e1;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.inventory-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inventory-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px 10px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
}

.inventory-item[draggable="true"] {
  cursor: grab;
}

.inventory-item[draggable="true"]:active {
  cursor: grabbing;
  opacity: 0.5;
}

.inventory-item:hover {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateX(2px);
}

.inventory-section[dragging="true"] {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}

.item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #f3f4f6;
  margin-bottom: 4px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.item-emoji {
  font-size: 16px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.item-stats {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  padding-left: 22px;
  letter-spacing: 0.3px;
}

.item-sell-price {
  font-size: 12px;
  color: #fbbf24;
  font-weight: 700;
  text-align: right;
  margin-top: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.inventory-item-tooltip {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%) translateX(8px);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-radius: 6px;
  padding: 4px 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 8px rgba(59, 130, 246, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  white-space: nowrap;
}

.inventory-item:hover .inventory-item-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(12px);
}

.inventory-item.sellable {
  cursor: pointer;
}

.inventory-item.sellable:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: rgba(251, 191, 36, 0.4);
  transform: scale(1.02);
  box-shadow: 0 4px 8px rgba(251, 191, 36, 0.3);
}

.inventory-item.sellable:active {
  transform: scale(0.98);
}


/* Inventory Compact View */
.inventory-compact {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 4px 8px;
  width: 100% !important;
  box-sizing: border-box;
}

.inventory-compact.no-padding {
  padding: 0;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-width: 120px;
}

.inventory-icon-wrapper {
  position: relative;
}

.inventory-icon-wrapper[draggable="true"] {
  cursor: grab;
}

.inventory-icon-wrapper[draggable="true"]:active {
  cursor: grabbing;
  opacity: 0.5;
}

.inventory-icon-wrapper.battle-log {
  display: inline;
}

.inventory-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
  /* background: rgba(30, 30, 40, 0.4); */
  background: rgba(0, 0, 0, 0.25);
}

.equipment-slot.rarity-magic,
.relic-slot.rarity-magic,
.rarity-magic .inventory-icon {
  background: radial-gradient(circle at center, var(--rarity-magic), rgba(0, 0, 0, 0.25));
}

.equipment-slot.rarity-epic,
.relic-slot.rarity-epic,
.rarity-epic .inventory-icon {
  background: radial-gradient(circle at center, var(--rarity-epic), rgba(0, 0, 0, 0.25));
}

.equipment-slot.rarity-legendary,
.relic-slot.rarity-legendary,
.rarity-legendary .inventory-icon {
  background: radial-gradient(circle at center, var(--rarity-legendary), rgba(0, 0, 0, 0.25));
}

.equipment-slot.rarity-unique,
.relic-slot.rarity-unique,
.rarity-unique .inventory-icon {
  background: radial-gradient(circle at center, var(--rarity-unique), rgba(0, 0, 0, 0.25));
}

.equipment-slot.rarity-mythic,
.relic-slot.rarity-mythic,
.rarity-mythic .inventory-icon {
  background: radial-gradient(circle at center, var(--rarity-mythic), rgba(0, 0, 0, 0.25));
}

.inventory-icon-wrapper:hover .inventory-icon {
  transform: scale(1.15);
}

/* Spell and buff icons should not have background or hover effect */
.spell-icon-compact,
.buff-icon-compact {
  background: none !important;
  font-size: 18px;
}

.inventory-compact.no-padding .buff-icon-wrapper {
  width: 32px;
  height: 32px;
}

.inventory-compact.no-padding .buff-icon-compact {
  font-size: 16px;
  padding: 2px;
}

.spell-icon-wrapper:hover .spell-icon-compact,
.buff-icon-wrapper:hover .buff-icon-compact {
  transform: none !important;
  background: none !important;
}

/* Completely disable hover effects on buff/spell icon wrappers */
.buff-icon-wrapper:hover,
.spell-icon-wrapper:hover {
  cursor: default;
}

.buff-icon-wrapper .inventory-icon,
.spell-icon-wrapper .inventory-icon {
  background: none !important;
  padding: 2px !important;
}

/* When there are many buffs, shrink the avatar and adjust buff display */
.unit-avatar-shrink img {
  width: 80px !important;
  height: 80px !important;
  transition: all 0.3s ease;
}

.buffs-many {
  max-height: 108px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 90, 43, 0.5) rgba(0, 0, 0, 0.2);
  padding-right: 4px !important;
}

.buffs-many::-webkit-scrollbar {
  width: 6px;
}

.buffs-many::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.buffs-many::-webkit-scrollbar-thumb {
  background: rgba(139, 90, 43, 0.5);
  border-radius: 3px;
}

.buffs-many::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 90, 43, 0.7);
}

/* Inventory Tooltip */
.inventory-tooltip {
  position: absolute;
  bottom: 100%;
  left: 100%;
  transform: translate(8px, 0);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 250px;
  max-width: 350px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(59, 130, 246, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10000;
}

.inventory-icon-wrapper:hover .inventory-tooltip {
  opacity: 1;
  transform: translate(12px, 0);
}

/* Buff tooltips should appear to the bottom-right */
.buff-icon-wrapper .inventory-tooltip {
  bottom: auto;
  top: 100%;
  left: 100%;
  transform: translate(8px, 8px);
}

.buff-icon-wrapper:hover .inventory-tooltip {
  transform: translate(12px, 12px);
}

/* Inventory comparison tooltip for gear items */
.inventory-comparison-tooltip {
  position: absolute;
  bottom: 100%;
  left: 100%;
  transform: translate(290px, 0);
  z-index: 10001;
  pointer-events: none;
}

.comparison-tooltip-content {
  position: relative;
}

.comparison-tooltip-content .inventory-tooltip {
  position: relative;
  bottom: 0;
  left: 0;
  transform: none;
  z-index: 10001;
}

.inventory-comparison-tooltip .equipped-label {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95) 0%, rgba(22, 163, 74, 0.95) 100%);
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 10002;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.inventory-icon-wrapper:hover .inventory-comparison-tooltip {
  display: block;
}

.inventory-icon-wrapper:hover .comparison-tooltip-content .inventory-tooltip {
  opacity: 1 !important;
  display: block !important;
}

.inventory-icon-wrapper:hover .inventory-comparison-tooltip .equipped-label {
  opacity: 1;
}

/* Hide tooltips during drag */
[draggable="true"]:active .inventory-tooltip {
  display: none !important;
}

.tooltip-header {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 4px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  padding-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tooltip-header.no-border {
  padding-bottom: 0;
  border-bottom: none;
}

.item-type-badge {
  position: absolute;
  bottom: 10px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: auto;
  white-space: nowrap;

  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.item-type-badge.rarity-magic {
  background: color-mix(in srgb, var(--rarity-magic) 40%, transparent);
  border: 1px solid color-mix(in srgb, var(--rarity-magic) 60%, transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  color: rgba(255, 255, 255, 0.8);
}

.item-type-badge.rarity-epic {
  background: color-mix(in srgb, var(--rarity-epic) 40%, transparent);
  border: 1px solid color-mix(in srgb, var(--rarity-epic) 60%, transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  color: rgba(255, 255, 255, 0.8);
}

.item-type-badge.rarity-legendary {
  background: color-mix(in srgb, var(--rarity-legendary) 40%, transparent);
  border: 1px solid color-mix(in srgb, var(--rarity-legendary) 60%, transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  color: rgba(255, 255, 255, 0.8);
}

.item-type-badge.rarity-unique {
  background: color-mix(in srgb, var(--rarity-unique) 40%, transparent);
  border: 1px solid color-mix(in srgb, var(--rarity-unique) 60%, transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  color: rgba(255, 255, 255, 0.8);
}

.item-type-badge.rarity-mythic {
  background: color-mix(in srgb, var(--rarity-mythic) 40%, transparent);
  border: 1px solid color-mix(in srgb, var(--rarity-mythic) 60%, transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  color: rgba(255, 255, 255, 0.8);
}


.badge-relic {
  background: rgba(234, 179, 8, 0.3);
  border: 1px solid rgba(234, 179, 8, 0.6);
  color: #fde047;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.badge-gear {
  background: rgba(168, 85, 247, 0.3);
  border: 1px solid rgba(168, 85, 247, 0.6);
  color: #d8b4fe;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.tooltip-content {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 500;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

/* Potion Toggle Indicator */
.potion-toggle-indicator {
  position: absolute;
  top: -4px;
  right: -4px;
  background: rgba(34, 197, 94, 0.9);
  border: 2px solid #22c55e;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.inventory-item.potion-enabled {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.4);
}

.inventory-item.potion-enabled:hover {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.6);
}

/* Button Tooltip Wrapper */
.button-tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.button-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(59, 130, 246, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  white-space: nowrap;
}

.button-tooltip-wrapper:hover .button-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}

/* Button Styles */
button {
  padding: 16px 32px;
  font-size: 40px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  position: relative;
  white-space: nowrap;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.3),
    0 6px 12px rgba(0, 0, 0, 0.2);
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.3),
    0 8px 16px rgba(0, 0, 0, 0.3);
}

button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.3),
    0 4px 8px rgba(0, 0, 0, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.75;
  filter: grayscale(0.5);
  transform: none;
}

/* Primary Button (default) */
button {
  background: linear-gradient(180deg, #9ca3af 0%, #6b7280 100%);
  color: #ffffff;
}

button.small {
  font-size: 20px;
}

/* Danger/Fight Button */
button.danger {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
}

button.danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
}

/* Success/Heal Button */
button.success {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
}

button.success:hover:not(:disabled) {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
}

/* Warning/Level Up Button */
button.warning {
  background: linear-gradient(180deg, #eab308 0%, #ca8a04 100%);
}

button.warning:hover:not(:disabled) {
  background: linear-gradient(180deg, #facc15 0%, #eab308 100%);
}

/* Secondary/Neutral Button */
button.secondary {
  background: linear-gradient(180deg, #6b7280 0%, #4b5563 100%);
}

button.secondary:hover:not(:disabled) {
  background: linear-gradient(180deg, #9ca3af 0%, #6b7280 100%);
}

/* Game Over Button */
button.game-over {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
}

/* Stores */
h2.store {
  text-align: center;
}

button.buy {
  margin-top: 10px;
  padding: 8px 16;
  font-size: 20px;
  border-radius: 4px;
}

.merchant-drop-zone {
  padding: 16px;
  border-radius: 12px;
  transition: all 0.2s ease;
  min-height: 300px;
}

.merchant-drop-zone:has(*:hover) {
  background: rgba(251, 191, 36, 0.05);
  border: 2px dashed rgba(251, 191, 36, 0.3);
}

button.reroll {
  font-size: 25px;
  padding: 5px;
  background: none;
  border: none;
  box-shadow: none;
}

/* Attack Animations */
@keyframes lunge-right {
  0% {
    transform: scale(1) translateX(0);
  }

  50% {
    transform: scale(1.05) translateX(40px);
  }

  100% {
    transform: scale(1) translateX(0);
  }
}

@keyframes lunge-left {
  0% {
    transform: scale(1) translateX(0);
  }

  50% {
    transform: scale(1.05) translateX(-40px);
  }

  100% {
    transform: scale(1) translateX(0);
  }
}

@keyframes lunge-down {
  0% {
    transform: scale(1) translateY(0);
  }

  50% {
    transform: scale(1.05) translateY(20px);
  }

  100% {
    transform: scale(1) translateY(0);
  }
}

/* Player Attacking (Lunge Right) */
.action-lunge-right {
  animation: lunge-right 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10001;
}

/* Enemy Attacking (Lunge Left) */
.action-lunge-left {
  animation: lunge-left 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 15px #ff4444;
  z-index: 10001;
  border-color: #ff4444;
}

/* Stunned (Lunge Down) */
.action-stunned {
  animation: lunge-down 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 15px #9333ea;
  z-index: 10001;
  border-color: #9333ea;
}

/* Floating Numbers */
@keyframes float-up {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  66% {
    transform: translateY(-40px);
    opacity: 1;
  }

  100% {
    transform: translateY(-80px);
    opacity: 0;
  }
}

.floating-number {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 32px;
  font-weight: bold;
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.9),
    -1px -1px 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 1000;
  animation: float-up 3s ease-out forwards;
}

.floating-damage {
  color: #ff6b6b;
}

.floating-crit {
  color: yellow;
}

.floating-ult {
  color: cyan;
}

.floating-heal {
  color: #51cf66;
}

.hero-selection-wrapper {
  position: relative;
  display: inline-block;
}

.starting-hero-choice {
  transition: all 0.3s ease;
  border-radius: 8px;
}

.starting-hero-choice:hover {
  cursor: pointer;
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.6),
    0 0 60px rgba(255, 215, 0, 0.4),
    0 8px 16px rgba(0, 0, 0, 0.5);
  filter: brightness(1.15);
}

.hero-ability-tooltip {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  border: 2px solid rgba(255, 215, 0, 0.6);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 180px;
  max-width: 350px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(255, 215, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.hero-ability-tooltip.warrior {
  border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(59, 130, 246, 0.4);
}

.hero-ability-tooltip.mage {
  border-color: #9333ea;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(147, 51, 234, 0.4);
}

.hero-ability-tooltip.rogue {
  border-color: #eab308;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(234, 179, 8, 0.4);
}

.hero-selection-wrapper:hover .hero-ability-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(12px);
}

/* Spell Cooldown Styles */
.spell-on-cooldown {
  filter: grayscale(100%) opacity(0.7);
}

.spell-cooldown-number {
  position: absolute;
  top: 10px;
  left: 14px;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: bold;
  color: #ffffff;
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.9),
    -1px -1px 2px rgba(0, 0, 0, 0.9),
    0 0 8px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 10;
}

.inventory-compact.no-padding .spell-cooldown-number {
  top: 6px;
  left: 50%;
  font-size: 10px;
}

.buff-stack-count {
  position: absolute;
  bottom: 1px;
  right: 1px;
  font-size: 9px;
  font-weight: bold;
  color: #ffd700;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 215, 0, 0.6);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow:
    1px 1px 2px rgba(0, 0, 0, 0.9),
    -1px -1px 1px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 10;
}

.subclass-star {
  font-size: 10px;
  vertical-align: top;
}

/* Random Event Styles */
/* Event Card - Parchment Style (Compact, No Animations) */
.random-event .inner {
  padding-top: 200px;
}

.event-card-parchment {
  background: linear-gradient(135deg, rgba(245, 222, 179, 0.98) 0%, rgba(222, 184, 135, 0.98) 100%);
  border: 3px solid rgba(139, 90, 43, 0.8);
  border-radius: 16px;
  padding: 24px;
  max-width: 1100px;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(139, 90, 43, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1);
  color: #3e2723;
  position: relative;
}

.event-card-parchment::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 2px solid rgba(139, 90, 43, 0.3);
  border-radius: 12px;
  pointer-events: none;
}

.event-header-parchment {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(210, 180, 140, 0.6) 0%, rgba(190, 160, 120, 0.6) 100%);
  border: 2px solid rgba(139, 90, 43, 0.5);
  border-radius: 10px;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.15),
    0 2px 4px rgba(255, 255, 255, 0.2);
}

.event-emoji-parchment {
  font-size: 36px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.event-title-parchment {
  font-size: 1.75rem;
  margin: 0;
  color: #3e2723;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.event-content-parchment {
  margin-bottom: 16px;
}

.event-right-column {
  flex: 1;
}

.event-description-parchment {
  font-size: 1rem;
  line-height: 1.6;
  color: #3e2723;
  margin-bottom: 16px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(210, 180, 140, 0.4) 0%, rgba(190, 160, 120, 0.4) 100%);
  border: 2px solid rgba(139, 90, 43, 0.4);
  border-radius: 8px;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.15),
    0 1px 2px rgba(255, 255, 255, 0.3);
}

.event-right-column .event-description-parchment {
  margin-bottom: 0;
}

.event-image-parchment {
  flex-shrink: 0;
}

.event-image-parchment img {
  width: 360px;
  height: auto;
  border-radius: 8px;
  border: 3px solid rgba(139, 90, 43, 0.6);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.2);
  display: block;
}

.event-choices-parchment {
  width: 100%;
}

.event-choice-button-parchment {
  width: 100%;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(210, 180, 140, 0.8) 0%, rgba(190, 160, 120, 0.8) 100%);
  border: 3px solid rgba(139, 90, 43, 0.7);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow:
    0 4px 0 rgba(100, 60, 30, 0.4),
    0 6px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.3),
    inset 0 -1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  top: 0;
}

.event-choice-button-parchment:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(230, 200, 160, 0.9) 0%, rgba(210, 180, 140, 0.9) 100%);
  border-color: rgba(139, 90, 43, 0.9);
  top: 2px;
  box-shadow:
    0 2px 0 rgba(100, 60, 30, 0.4),
    0 4px 6px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.1);
}

.event-choice-button-parchment:active:not(:disabled) {
  top: 4px;
  box-shadow:
    0 0 0 rgba(100, 60, 30, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.event-choice-button-parchment:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.event-choice-label-parchment {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.3;
  color: #3e2723;
  text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.3);
}

.event-choice-info-parchment {
  font-size: 0.9rem;
  line-height: 1.4;
  color: #5d4037;
  opacity: 0.95;
  text-shadow: none;
}

/* rarity */
:root {
  --rarity-common: #d1d5db;
  --rarity-magic: #3b82f6;
  --rarity-epic: #22c55e;
  --rarity-legendary: #f59e0b;
  --rarity-unique: #ef4444;
  --rarity-mythic: #a855f7;
}

.rarity-common {
  color: var(--rarity-common);
}

.rarity-magic {
  color: var(--rarity-magic);
}

.rarity-epic {
  color: var(--rarity-epic);
}

.rarity-legendary {
  color: var(--rarity-legendary);
}

.rarity-unique {
  color: var(--rarity-unique);
}

.rarity-mythic {
  color: var(--rarity-mythic);
}

/* Equipment Display */
.stats-section,
.equipment-section {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.35) 100%);
  border-radius: 10px;
  padding: 16px;
  border: 2px solid rgba(139, 90, 43, 0.3);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
  width: 100% !important;
  box-sizing: border-box;
}

.unit-card-modal .equipment-section {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.4) 100%);
  border: 2px solid rgba(139, 90, 43, 0.4);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4), 0 3px 10px rgba(0, 0, 0, 0.3);
  padding: 12px;
  width: auto;
}

.equipment-stats-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  position: relative;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
}

.stat-row:hover {
  background: rgba(0, 0, 0, 0.3);
}

.stat-row-label {
  font-weight: bold;
  min-width: 90px;
  flex-shrink: 0;
  font-size: 1.05em;
  letter-spacing: 0.3px;
  color: #f4d03f;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.stat-row-value {
  text-align: right;
  flex-shrink: 0;
  font-size: 1.15em;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.stat-row-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.stat-row-content .stat-row-value {
  text-align: left;
  font-size: 0.95em;
  font-weight: normal;
  margin-bottom: 2px;
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.stat-row-content .progress-bar-bg {
  width: 100%;
  height: 10px;
  border-radius: 5px;
}

/* Add separator after HP/Energy rows */
.stat-row:has(.stat-row-content) {
  border-bottom: 2px solid rgba(0, 0, 0, 0.15);
  margin-bottom: 4px;
  padding-bottom: 12px;
}

.stat-row:has(.stat-row-content):last-of-type {
  margin-bottom: 8px;
}

.equipment-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.equipment-row {
  display: flex;
  gap: 6px;
}

.equipment-row-single {
  justify-content: center;
}

.equipment-row-triple {
  justify-content: space-between;
}

.equipment-row-relics {
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.equipment-relics-label {
  font-size: 11px;
  font-weight: 600;
  color: #fde047;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.equipment-slot {
  position: relative;
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.25);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.equipment-empty {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(203, 213, 225, 0.5);
  text-align: center;
}

.equipment-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.equipment-emoji {
  font-size: 32px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  cursor: pointer;
  transition: transform 0.2s ease;
  background: none;
}

.equipment-item:hover .equipment-emoji {
  transform: scale(1.15);
}

.equipment-item {
  position: relative;
}

.equipment-item[draggable="true"] {
  cursor: grab;
}

.equipment-item[draggable="true"]:active {
  cursor: grabbing;
}

.equipment-item .inventory-tooltip {
  position: absolute;
  bottom: 100%;
  left: 100%;
  transform: translate(8px, 0);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 250px;
  max-width: 350px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(59, 130, 246, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10000;
}

.equipment-item:hover .inventory-tooltip {
  opacity: 1;
  transform: translate(12px, 0);
}

/* Hide tooltips during equipment drag */
.equipment-item[draggable="true"]:active .inventory-tooltip {
  display: none !important;
}

/* Relics Section */
.relics-label {
  font-size: 11px;
  font-weight: 600;
  color: #fde047;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 4px;
}

.relics-grid {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.relic-slot {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.25);
  border: 2px dashed rgba(253, 224, 71, 0.3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.relic-slot:hover {
  border-color: rgba(253, 224, 71, 0.6);
  /* background: rgba(0, 0, 0, 0.35); */
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(253, 224, 71, 0.2);
}

.relic-empty {
  font-size: 10px;
  font-weight: 600;
  color: rgba(253, 224, 71, 0.4);
  text-align: center;
}

.relic-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.relic-emoji {
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(253, 224, 71, 0.3));
  cursor: pointer;
  transition: transform 0.2s ease;
  background: none;
}

.relic-item:hover .relic-emoji {
  transform: scale(1.15);
}

.relic-item[draggable="true"] {
  cursor: grab;
}

.relic-item[draggable="true"]:active {
  cursor: grabbing;
}

.relic-item .inventory-tooltip {
  position: absolute;
  bottom: 100%;
  left: 100%;
  transform: translate(8px, 0);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  border: 2px solid rgba(253, 224, 71, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 180px;
  max-width: 350px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(253, 224, 71, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.relic-item:hover .inventory-tooltip {
  opacity: 1;
  transform: translate(12px, 0);
}

/* Hide tooltips during relic drag */
.relic-item[draggable="true"]:active .inventory-tooltip {
  display: none !important;
}

/* Empty gear slot in compact view (invisible placeholder) */
.gear-empty-compact .inventory-icon {
  color: transparent;
}

/* Relic in compact view */
.relic-compact {
  /* No border in compact view */
}

.relic-empty-compact .inventory-icon {
  color: transparent;
}

.relic-empty-compact-placeholder {
  color: transparent;
}

/* Empty inventory slot placeholder */
.inventory-empty-slot .inventory-icon {
  color: transparent;
}

/* Enhanced Tooltip Design */
.tooltip-enhanced {
  display: flex;
  gap: 12px;
  padding: 12px 16px !important;
  min-width: 250px;
  max-width: 350px;
}

.tooltip-icon-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  order: 2;
  padding-bottom: 25px;
}

.tooltip-icon-large {
  font-size: 60px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.tooltip-badge-bottom {
  font-size: 8px !important;
  padding: 2px 4px !important;
  margin: 0 !important;
  white-space: nowrap;
  text-align: center;
}

.tooltip-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  order: 1;
  color: #fff;
}

.tooltip-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.tooltip-title.no-stats {
  border-bottom: none;
  padding-bottom: 0;
}

.tooltip-title .item-card {
  font-size: 15px;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.tooltip-title .item-card.gold-header {
  color: #ffffff;
}

.tooltip-gold-amount {
  font-size: 13px;
  color: #fbbf24;
  font-weight: 600;
  margin-top: 4px;
}

.tooltip-stats-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tooltip-stats-list li {
  font-size: 12px;
  color: #fbbf24;
  font-weight: 600;
  padding-left: 12px;
  position: relative;
}

.tooltip-stats-list.bare {
  list-style: none;
}

.tooltip-stats-list.bare li {
  padding-left: 0;
}

.tooltip-stats-list li::before:not(.bare) {
  content: "•";
  position: absolute;
  left: 0;
  color: #fbbf24;
  font-weight: bold;
}

.tooltip-description {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 500;
  line-height: 1.4;
  font-style: italic;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.tooltip-spell {
  font-size: 12px;
  color: #fbbf24;
  font-weight: 600;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.tooltip-charges {
  font-size: 12px;
  color: #60a5fa;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.tooltip-extra {
  font-size: 11px;
  color: #86efac;
  font-weight: 600;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

/* Party Member Group - Hero + Minions */
.party-member-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Minions Container */
.minions-container {
  display: flex;
  flex-direction: row;
  gap: 4px;
  margin-top: 8px;
  margin-left: 0;
  justify-content: center;
  min-height: 50px;
  width: 100%;
}

.minions-drop-zone-empty {
  width: 100%;
  min-height: 50px;
}

.tavern-minions-container {
  display: flex;
  flex-direction: row;
  gap: 4px;
  margin-top: 8px;
  justify-content: center;
  min-height: 50px;
  width: 100%;
}

.tavern-minions-drop-zone-empty {
  width: 100%;
  min-height: 50px;
}

/* Minions Label */
.minions-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #cbd5e1;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  opacity: 0.6;
  margin-bottom: 0;
}

/* Individual Minion Wrapper */
.minion-wrapper {
  transform: scale(1);
  transform-origin: center center;
  transition: all 0.3s ease;
  cursor: grab;
}

.minion-wrapper:active {
  cursor: grabbing;
}

.minion-wrapper:hover,
.minion-wrapper.minion-hovered {
  transform: scale(1.05);
  z-index: 999;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
}

.minion-wrapper .inventory-section,
.minion-wrapper .equipment-section {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.5s ease;
}

.minion-wrapper:hover .inventory-section,
.minion-wrapper:hover .equipment-section,
.minion-wrapper.minion-hovered .inventory-section,
.minion-wrapper.minion-hovered .equipment-section {
  max-height: 800px;
  opacity: 1;
  display: inherit;
}

.select-hero-container .logo {
  margin-top: 10px;
}

.select-hero-container h1 {
  margin-top: 300px;
}

.choose-starting-character {
  margin-top: 70px;
  transform: scale(1.25);
}

.town-nav button {
  font-size: 18px;
  padding: 10px;
  margin-left: 40px;
  width: 150px;
}

.town-nav button.tavern {
  background: linear-gradient(180deg, #8b5a2b 0%, #654321 100%);
}

.town-nav button.temple {
  background: linear-gradient(180deg, #2b768b 0%, #215965 100%);
}

button.merchant,
.town-nav button.merchant {
  background: linear-gradient(180deg, #b8860b 0%, #8b6914 100%);
}

button.merchant:hover,
.town-nav button.merchant:hover {
  background: linear-gradient(180deg, #d4a520 0%, #a67c1b 100%);
}

.town-nav button.graveyard,
.town-nav button.graveyard:hover,
.town-nav button.graveyard:hover:not(:disabled),
button.graveyard,
button.graveyard:hover,
button.graveyard:hover:not(:disabled) {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
}

button.graveyard-btn {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
  border: 2px solid rgba(42, 42, 42, 0.5);
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  flex: 1;
}

button.graveyard-btn:hover {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
}

button.graveyard-btn.merchant-tab-active {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

/* Loot Screen */
.loot-grid {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.loot-item-card {
  width: 200px;
  cursor: grab;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: linear-gradient(135deg, rgba(30, 30, 40, 0.95), rgba(20, 20, 30, 0.95));
  border-radius: 12px;
  border: 2px solid rgba(100, 100, 120, 0.4);
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  gap: 12px;
  min-width: 250px;
  max-width: 350px;
}

.loot-item-card:active {
  cursor: grabbing;
}

.loot-item-card:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.4);
}

.loot-hero-selected .tavern-hero-card {
  border-color: rgba(255, 215, 0, 0.9) !important;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

.loot-hero-chevron {
  font-size: 24px;
  color: rgb(255, 215, 0);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
  transition: opacity 0.2s ease;
}

.room-loot {
  background: linear-gradient(135deg, rgba(245, 222, 179, 0.85) 0%, rgba(222, 184, 135, 0.85) 100%);
  border: 3px solid rgba(139, 90, 43, 0.9);
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4), 0 0 20px rgba(139, 90, 43, 0.3);
  padding: 20px;
  width: 640px;
  color: #3e2723;
}

.room-loot hr {
  border-bottom: 1px solid rgba(139, 90, 43, 0.9);
}

.room-loot h1 {
  margin-top: 0;
  margin-bottom: 0;
}

.room-loot button {
  margin-bottom: 12px;
}

.room-loot .loot-item-card {
  box-shadow: 10px 10px 26px rgba(0, 0, 0, 0.7);
}

/* Loot Item Wrapper for comparison tooltips */
.loot-item-wrapper {
  position: relative;
}

/* Allow tooltip to overflow loot containers */
.loot-modal-content,
.room-loot,
.loot-grid,
.loot-item-display {
  overflow: visible;
}

.loot-comparison-tooltip {
  position: absolute;
  top: auto;
  bottom: 0;
  left: 100%;
  transform: translate(20px, 0);
  z-index: 10001;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.loot-comparison-tooltip .inventory-tooltip {
  position: relative;
  left: 0;
  bottom: 0;
  transform: none;
  z-index: 10002;
  opacity: 1;
}

.loot-item-wrapper:has(.loot-item-card:hover) .loot-comparison-tooltip {
  opacity: 1;
}

.loot-item-wrapper:has(.loot-item-card:hover) .equipped-label {
  opacity: 1;
}

.action-buttons-container {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  /* margin-top: -70px; */
  /* margin-bottom: 20px; */
}

.action-buttons-container button {
  padding: 8px 14px;
  font-size: 24px;
}

/* Victory Screen */
.victory-screen {
  min-height: 1080px;
  color: white;
  background-image: url(/img/bg/victory.webp) !important;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.victory-screen>* {
  transform: scale(0.9);
  transform-origin: top center;
}

.victory-stats-container {
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 30px;
  width: 100%;
  max-width: 900px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(156, 163, 175, 0.1);
}

.victory-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .victory-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.victory-stat-card {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.victory-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

.victory-stat-value {
  font-size: 32px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
}

.victory-stat-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.portrait {
  overflow: hidden;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 2px solid rgba(139, 90, 43, 0.6);
  background: linear-gradient(to bottom right, var(--bg-start), var(--bg-end));
}

.tavern-hero-portrait.warrior,
.portrait.warrior {
  --bg-start: #2a5298;
  --bg-end: #0e1c36;
  /* --bg-start: #6ab7ff;
  --bg-end: #1e5799; */
}

.tavern-hero-portrait.rogue,
.portrait.rogue {
  --bg-start: #e6c35c;
  --bg-end: #b89a3e;
}

.tavern-hero-portrait.mage,
.portrait.mage {
  /* --bg-start: #c471ed;
  --bg-end: #6a2c91; */
  --bg-start: #51247a;
  --bg-end: #1b0b29;
}

.portrait img {
  width: 250px;
  height: 250px;
  margin-top: 2px;
  object-fit: cover;
  image-rendering: pixelated;
}

.unit-portrait,
.unit-portrait.portrait {
  height: 180px;
  width: 180px;
}

.merchant-hero-display .unit-portrait.portrait.no-modal {
  height: 100px;
  width: 100px;
}

.merchant-hero-display .unit-portrait.portrait.no-modal img {
  margin-left: -100px;
}

.merchant-hero-display .equipment-section,
.merchant-hero-display .inventory-section {
  padding-left: 0;
  padding-right: 0;
}

/* Sprite Sheet Support */
.sprite-icon {
  background-repeat: no-repeat;
  image-rendering: pixelated;
  /* Keeps sprites crisp */
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Ensure sprite icons in inventory/tooltips are properly sized */
.inventory-icon.sprite-icon {
  display: inline-block;
}

.tooltip-icon-large.sprite-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Inventory slot items - context-aware sizing */
.inventory-slot-item {
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(139, 90, 43, 0.4);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  padding: 2px;
  position: relative;
}

/* Larger in modal context */
.unit-card-modal .inventory-slot-item {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  font-size: 20px;
}

/* Position badge at bottom right of enhanced tooltips */
.tooltip-enhanced .tooltip-badge-bottom {
  position: absolute;
  bottom: 8px;
  right: 8px;
}

/* Rarity glows for inventory slot items */
.inventory-slot-item.rarity-magic {
  background: radial-gradient(circle at center, var(--rarity-magic), rgba(0, 0, 0, 0.3)) !important;
}

.inventory-slot-item.rarity-epic {
  background: radial-gradient(circle at center, var(--rarity-epic), rgba(0, 0, 0, 0.3)) !important;
}

.inventory-slot-item.rarity-legendary {
  background: radial-gradient(circle at center, var(--rarity-legendary), rgba(0, 0, 0, 0.3)) !important;
}

.inventory-slot-item.rarity-unique {
  background: radial-gradient(circle at center, var(--rarity-unique), rgba(0, 0, 0, 0.3)) !important;
}

.inventory-slot-item.rarity-mythic {
  background: radial-gradient(circle at center, var(--rarity-mythic), rgba(0, 0, 0, 0.3)) !important;
}

/* Empty slot tooltips should be compact */
.inventory-tooltip:has(.tooltip-header.no-border) {
  min-width: max-content;
  max-width: 200px;
}

/* Preserve rarity glows on equipment slot hover */
.equipment-slot.rarity-magic:hover,
.equipment-slot.rarity-epic:hover,
.equipment-slot.rarity-legendary:hover,
.equipment-slot.rarity-unique:hover,
.equipment-slot.rarity-mythic:hover {
  border-color: rgba(255, 255, 255, 0.4) !important;
}

.tooltip-gold-value {
  color: white;
}