﻿/* =============================================================
   COMBAT SYSTEM STYLES
   Combat modal, battlefield, CT bars, spell/ability selection,
   combat log, damage numbers, status effects, animations.
   Source: original styles.css lines 3292-7673
   ============================================================= */
/* Combat Modal */
.combat-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 6, 18, 0.98);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.combat-modal.active {
  display: flex;
}

.combat-effects-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1100;
  overflow: hidden;
}

.screen-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}

.screen-shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

.spell-projectile {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, transparent);
  box-shadow: 0 0 10px #fff;
  z-index: 1101;
  transform: translate(-50%, -50%);
}

.spell-impact {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, transparent);
  animation: impactFade 0.5s ease-out forwards;
  z-index: 1101;
  transform: translate(-50%, -50%);
}

@keyframes impactFade {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* â”€â”€ Ability fast-feedback flash â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@keyframes abilityFlash {
  0%   { filter: brightness(1) drop-shadow(0 0 0px #f0c040); }
  25%  { filter: brightness(2.5) drop-shadow(0 0 14px #f0c040); }
  60%  { filter: brightness(1.6) drop-shadow(0 0 8px #f0c040); }
  100% { filter: brightness(1) drop-shadow(0 0 0px #f0c040); }
}
.ability-flash {
  animation: abilityFlash 0.38s ease-out forwards;
}

/* â”€â”€ Spell charge-up â†’ release â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@keyframes spellCharging {
  0%   { filter: brightness(1)   drop-shadow(0 0 0px  var(--spell-charge-color, #00e5ff)); }
  40%  { filter: brightness(1.4) drop-shadow(0 0 10px var(--spell-charge-color, #00e5ff)); }
  70%  { filter: brightness(1.7) drop-shadow(0 0 18px var(--spell-charge-color, #00e5ff)); }
  100% { filter: brightness(2.2) drop-shadow(0 0 26px var(--spell-charge-color, #00e5ff)); }
}
@keyframes spellRelease {
  0%   { filter: brightness(2.2) drop-shadow(0 0 26px var(--spell-charge-color, #00e5ff)); transform: scale(1.08); }
  60%  { filter: brightness(3.5) drop-shadow(0 0 50px var(--spell-charge-color, #00e5ff)); transform: scale(1.12); }
  100% { filter: brightness(1)   drop-shadow(0 0 0px  var(--spell-charge-color, #00e5ff)); transform: scale(1); }
}
.spell-charging {
  animation: spellCharging 0.7s ease-in forwards;
}
.spell-release {
  animation: spellRelease 0.35s ease-out forwards;
}


.combat-container {
  border: 3px solid #daa520;
  padding: 20px;
  background: rgba(20, 10, 35, 0.98);
  width: 99vw;
  height: 98vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 15px;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.5);
  border-radius: 8px;
}

.combat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid #daa520;
  flex-shrink: 0;
}

.combat-header h2 {
  margin: 0;
  text-shadow: 0 0 15px #daa520;
  font-size: 2em;
  color: #f4e4c1;
}

.turn-indicator {
  font-size: 1.2em;
  color: #daa520;
  font-weight: bold;
}

/* THREE COLUMN LAYOUT */
.combat-three-column-layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 15px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Left and Right Character Columns */
.combat-column {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: rgba(10, 5, 20, 0.4);
  border: 2px solid rgba(138, 103, 255, 0.3);
  border-radius: 8px;
  padding: 10px;
  height: 100%;
}

.combat-left-column {
  border-left: 3px solid #8a67ff;
}

.combat-right-column {
  border-right: 3px solid #8a67ff;
}

.characters-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Character Card in Side Panels */
.character-combat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: rgba(20, 10, 35, 0.7);
  border: 2px solid var(--character-color, #8a67ff);
  border-radius: 6px;
  transition: all 0.3s;
}

.character-combat-card:hover {
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(138, 103, 255, 0.4);
}

.character-combat-card.completed {
  background: rgba(90, 58, 138, 0.4);
  border-color: #5a3a8a;
}

.character-combat-card.disabled {
  opacity: 0.5;
}

.character-combat-card.active-turn {
  border-color: #ffd700 !important;
  border-width: 3px !important;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4), inset 0 0 20px rgba(255, 215, 0, 0.25);
  animation: pulse-glow 1.5s ease-in-out infinite;
  position: relative;
  z-index: 10;
  transform: scale(1.02);
}

/* Portrait lunge animation override - used during attack animations */
.character-combat-card.lunging,
.character-combat-card.active-turn.lunging {
  animation: none !important; /* Disable pulse-glow during lunge */
  z-index: 100 !important;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4), inset 0 0 20px rgba(255, 215, 0, 0.25);
    border-color: #ffd700;
  }
  50% {
    box-shadow: 0 0 35px rgba(255, 215, 0, 1), 0 0 55px rgba(255, 215, 0, 0.6), inset 0 0 25px rgba(255, 215, 0, 0.35);
    border-color: #ffed4e;
  }
}

.character-combat-card.attack-shake {
  animation: hit-shake 420ms ease-out both;
}

.character-combat-card.taking-damage {
  animation: shake 0.3s;
  border-color: #f00;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
}

/* Thief vanish / stealth — semi-transparent to show the character is hidden */
.character-combat-card.is-stealthed {
  opacity: 0.35;
  filter: brightness(0.6) saturate(0.4);
  transition: opacity 0.5s ease, filter 0.5s ease;
}
.character-combat-card.is-stealthed .char-portrait {
  transition: opacity 0.5s ease, filter 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.character-card-portrait {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(138, 103, 255, 0.3);
}

.character-card-portrait img {
  width: 80px;
  height: 80px;
  border: 2px solid var(--character-color, #8a67ff);
  object-fit: contain;
  background: #0a0612;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

/* Slash effect for character card portraits */
.character-card-portrait img::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.95) 47%, rgba(255, 255, 255, 0.5) 49%, rgba(255, 255, 255, 0.95) 51%, transparent 63%),
    linear-gradient(125deg, transparent 40%, rgba(255, 200, 100, 0.8) 49%, transparent 58%);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transform: translateX(-120%) rotate(0deg) scaleX(0.3);
  filter: blur(0.5px);
  border-radius: 4px;
}

.character-combat-card.hit-slash .character-card-portrait img::after {
  animation: slash-swipe 350ms ease-out both;
}

.blood-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 64px;
  height: 80px;
  background: radial-gradient(circle at 50% 50%, rgba(220, 0, 0, 0.9) 0%, rgba(139, 0, 0, 0.7) 50%, rgba(80, 0, 0, 0.5) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease-in;
  border-radius: 4px;
  mix-blend-mode: multiply;
}

.character-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.character-card-name {
  font-weight: bold;
  font-size: 1em;
  color: #f4e4c1;
  text-shadow: 0 0 8px rgba(218, 165, 32, 0.5);
}

/* Resource Bars Container */
.character-resource-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

/* Individual Resource Bar Row */
.resource-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.resource-icon {
  font-size: 1.1em;
  width: 20px;
  text-align: center;
  cursor: help;
  flex-shrink: 0;
}

.resource-bar {
  flex: 1;
  height: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(138, 103, 255, 0.4);
  border-radius: 5px;
  overflow: visible;
  cursor: help;
  position: relative;
}

.resource-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75em;
  font-weight: 700;
  font-family: 'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', sans-serif;
  color: #ffffff;
  text-shadow: 
    0 0 3px rgba(0, 0, 0, 0.8),
    0 1px 2px rgba(0, 0, 0, 0.9),
    -1px -1px 0 #000, 
    1px -1px 0 #000, 
    -1px 1px 0 #000, 
    1px 1px 0 #000;
  pointer-events: none;
  white-space: nowrap;
  padding: 2px 0;
  line-height: 1;
  letter-spacing: 0.3px;
}

.resource-fill {
  height: 100%;
  transition: width 0.3s ease;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* HP Fill - Green gradient */
.hp-fill {
  background: linear-gradient(90deg, #00ff00, #00cc00);
}

/* MP Fill - Blue gradient */
.mp-fill {
  background: linear-gradient(90deg, #4da6ff, #0066cc);
}

/* Chakra Fill - Yellow/Electric gradient */
.chakra-fill {
  background: linear-gradient(90deg, #ffeb3b, #ffc107);
}

/* Resolve Fill - Orange/Red gradient */
.resolve-fill {
  background: linear-gradient(90deg, #ff9800, #ff5722);
}

/* Eye Strain Indicator */
.eye-strain-indicator {
  font-size: 0.75em;
  color: #ff6b6b;
  text-align: center;
  margin-top: 2px;
}

/* Defeated Status */
.defeated-status {
  text-align: center;
  padding: 8px 0;
}

/* Legacy HP bar styles (kept for compatibility) */
.character-card-stats {
  font-size: 0.8em;
  line-height: 1.3;
  color: #c9a870;
}

.character-card-hp {
  margin-top: 4px;
}

.hp-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #8a67ff;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2px;
}

.hp-text {
  font-size: 0.75em;
  color: #e8d4a0;
}

.character-card-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Center Enemy Column */
.combat-center-column {
  background: transparent;
  border: none;
  padding: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Round counter - visual removed, DOM node kept for JS logic */

/* Action Phase Title - Absolute positioned below round counter */
.action-phase-title {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(20, 10, 35, 0.95);
  border: 2px solid #daa520;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1.1em;
  font-weight: bold;
  color: #f4e4c1;
  text-shadow: 0 0 10px rgba(218, 165, 32, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  text-align: center;
  white-space: nowrap;
}

.enemy-battlefield {
  flex: 1;
  width: 100%;
  background-image: url('environment/combat_dungeon_1.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 3px solid #daa520;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 20px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.enemy-lines-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 2;
  width: 100%;
  justify-content: center;
  align-items: center;
  margin-top: 80px;
}

.enemy-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  width: 60%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  min-height: 120px;
  position: relative;
}

.enemy-line::before {
  content: attr(data-label);
  position: absolute;
  left: -120px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: bold;
  color: #daa520;
  font-size: 0.95em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px rgba(218, 165, 32, 0.5);
  width: 110px;
  text-align: right;
}

/* Character Lines on Battlefield */
.character-lines-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 2;
  width: 100%;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.character-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  width: 60%;
  padding: 10px;
  background: rgba(0, 0, 100, 0.2);
  border-radius: 8px;
  min-height: 120px;
  position: relative;
  border: 2px solid rgba(138, 103, 255, 0.3);
}

.character-line::before {
  content: attr(data-label);
  position: absolute;
  left: -120px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: bold;
  color: #8a67ff;
  font-size: 0.95em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 0 8px rgba(138, 103, 255, 0.5);
  width: 110px;
  text-align: right;
}

.character-line[data-line="0"]::before {
  content: "Front Line";
}

.character-line[data-line="1"]::before {
  content: "Back Line";
}

.character-sprite-container {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.character-sprite-container.active-turn {
  filter: drop-shadow(0 0 15px #daa520);
  transform: scale(1.05);
}

/* Portrait lunge animation override for battlefield sprites */
.character-sprite-container.lunging,
.character-sprite-container.active-turn.lunging {
  filter: none;
  z-index: 100 !important;
}

.character-sprite-container.active-turn .character-sprite {
  border-color: #daa520;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.8);
}

.character-sprite {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  border: 3px solid rgba(138, 103, 255, 0.5);
  display: block;
  object-fit: cover;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  transition: all 0.3s;
}

.character-sprite:hover {
  transform: scale(1.05);
  border-color: #8a67ff;
}

.character-hp-bar {
  width: 96px;
  height: 8px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(138, 103, 255, 0.5);
  margin-top: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.character-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff00, #00cc00);
  transition: width 0.3s ease-out;
}

.character-ct-bar-container {
  width: 96px;
  margin-top: 4px;
}

.character-ct-bar {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(138, 103, 255, 0.5);
  border-radius: 2px;
  overflow: hidden;
}

.enemy-line[data-line="0"] {
  /* Back line - displayed at top due to flex-direction: column-reverse */
}

.enemy-line[data-line="1"] {
  /* Front line - displayed at bottom due to flex-direction: column-reverse */
}

/* Enemy sprite rendering at 50% size (96x96 instead of 192x192) */
.enemy-sprite {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.7));
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
}

.enemy-sprite:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8));
}

.enemy-sprite-container {
  position: relative;
  display: inline-block;
  transition: transform 0.2s;
}

/* Portrait lunge animation override for enemy sprites */
.enemy-sprite-container.lunging {
  z-index: 100 !important;
  animation: none !important;
}

.enemy-sprite-container.targetable {
  cursor: pointer;
  transform: scale(1.05);
  filter: drop-shadow(0 0 15px rgba(218, 165, 32, 0.9));
}

.enemy-sprite-container.targetable:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1));
}

/* Back-row enemies that are protected by the front row */
.enemy-sprite-container.untargetable {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(60%);
}

.enemy-sprite-container.attack-lunge {
  animation: enemy-lunge 500ms ease-out both;
  z-index: 50;
}

.enemy-sprite-container.hit-shake {
  animation: hit-shake 420ms ease-out both;
}

.enemy-sprite-container.hit-shake .enemy-sprite {
  animation: hit-shake 380ms ease-out both;
}

/* Enemy status effect icons (bleed, burn, stun, freeze, poison, etc.) */
.enemy-status-icons {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 2px;
  z-index: 10;
  max-width: calc(100% - 36px); /* leave room for adaptation display on the right */
  pointer-events: none;
}

.enemy-status-icon {
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: help;
  position: relative;
  pointer-events: auto;
}

.enemy-status-icon.debuff {
  border: 1px solid #f44;
}

.enemy-status-icon.buff {
  border: 1px solid #4af;
}

.enemy-status-icon-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid #f44;
  border-radius: 3px;
  padding: 5px 7px;
  min-width: 150px;
  max-width: 220px;
  font-size: 11px;
  line-height: 1.4;
  color: #e8d4a0;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10000;
}

.enemy-status-icon:hover .enemy-status-icon-tooltip {
  opacity: 1;
  visibility: visible;
}

.enemy-status-icon-tooltip .tooltip-title {
  font-weight: bold;
  margin-bottom: 3px;
  color: #f44;
}

.enemy-status-icon-tooltip .tooltip-effect {
  margin-left: 4px;
  color: #8f8;
}

@keyframes enemy-lunge {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-15px) scale(1.15); }
  50% { transform: translateY(-10px) scale(1.12); }
  100% { transform: translateY(0) scale(1); }
}

.enemy-hp-bar {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 6px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #f00;
  border-radius: 3px;
  overflow: hidden;
}

.enemy-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff0000, #cc0000);
  transition: width 0.3s ease;
}

/* CT (Charge Time) Bars */
.ct-bar-container {
  width: 100%;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ct-bar {
  position: relative;
  width: 100%;
  height: 16px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #00aaff;
  border-radius: 3px;
  overflow: hidden;
}

.ct-fill {
  height: 100%;
  background: linear-gradient(90deg, #00aaff, #0088cc);
  transition: width 1s linear;
  box-shadow: 0 0 8px rgba(0, 170, 255, 0.5);
}

.ct-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75em;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9), 
               0 0 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 1;
}

/* Enemy CT Bar */
.enemy-ct-bar-container {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 4px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #00aaff;
  border-radius: 2px;
  overflow: hidden;
}

.enemy-ct-bar {
  width: 100%;
  height: 100%;
  position: relative;
}

.enemy-ct-bar .ct-fill {
  height: 100%;
  background: linear-gradient(90deg, #00aaff, #0088cc);
  transition: width 1s linear;
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   Boss Battle Styles
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* Extra-large boss sprite â€” spans both enemy rows */
.boss-extra-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.boss-extra-large .boss-sprite {
  width: 192px;
  height: 192px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(255, 50, 50, 0.8))
          drop-shadow(0 8px 16px rgba(0, 0, 0, 0.9));
  transition: all 0.3s;
  cursor: pointer;
  animation: boss-idle-pulse 3s ease-in-out infinite;
}

.boss-extra-large .boss-sprite:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 0 30px rgba(255, 50, 50, 1))
          drop-shadow(0 0 50px rgba(255, 0, 0, 0.5));
}

@keyframes boss-idle-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* Boss name plate */
.boss-name-plate {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1em;
  font-weight: bold;
  color: #ff4444;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.8),
               0 0 20px rgba(255, 0, 0, 0.4),
               0 2px 4px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  pointer-events: none;
  animation: boss-name-glow 2s ease-in-out infinite alternate;
}

@keyframes boss-name-glow {
  0% { text-shadow: 0 0 10px rgba(255, 0, 0, 0.8), 0 0 20px rgba(255, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.9); }
  100% { text-shadow: 0 0 20px rgba(255, 50, 50, 1), 0 0 40px rgba(255, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.9); }
}

/* Boss HP bar â€” wider and more prominent */
.boss-hp-bar {
  width: 180px !important;
  height: 10px !important;
  border: 2px solid #ff4444 !important;
  bottom: -14px !important;
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

.boss-hp-bar .enemy-hp-fill {
  background: linear-gradient(90deg, #ff0000, #ff4444, #ff6666);
  box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.3);
}

/* Boss CT bar */
.boss-ct-bar {
  width: 180px !important;
  bottom: -26px !important;
}

/* Boss enemy line â€” expanded to hold the extra-large sprite */
.boss-extra-large-line {
  min-height: 260px !important;
  padding: 30px 10px !important;
  background: rgba(80, 0, 0, 0.3) !important;
  border: 2px solid rgba(255, 50, 50, 0.4) !important;
  box-shadow: inset 0 0 30px rgba(255, 0, 0, 0.15);
}

/* Hide the second enemy line when boss spans both */
.boss-hidden-line {
  display: none !important;
}

/* Boss battlefield glow effect */
.boss-battlefield {
  box-shadow: inset 0 0 60px rgba(255, 0, 0, 0.3),
              0 0 20px rgba(255, 0, 0, 0.2) !important;
  border-color: #ff4444 !important;
}

/* Wave indicator overlay */
.wave-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #daa520;
  border-radius: 6px;
  color: #daa520;
  font-weight: bold;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 1px;
  z-index: 10;
  text-shadow: 0 0 8px rgba(218, 165, 32, 0.5);
}

.wave-indicator.boss-wave {
  border-color: #ff4444;
  color: #ff4444;
  text-shadow: 0 0 12px rgba(255, 0, 0, 0.6);
  animation: boss-wave-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes boss-wave-pulse {
  0% { box-shadow: 0 0 5px rgba(255, 0, 0, 0.3); }
  100% { box-shadow: 0 0 15px rgba(255, 0, 0, 0.6), 0 0 30px rgba(255, 0, 0, 0.3); }
}

/* Wave transition animation */
.wave-transition-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: wave-fade 2s ease-out forwards;
  pointer-events: none;
}

.wave-transition-text {
  font-size: 2em;
  font-weight: bold;
  color: #daa520;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-shadow: 0 0 20px rgba(218, 165, 32, 0.8),
               0 0 40px rgba(218, 165, 32, 0.4);
  animation: wave-text-appear 2s ease-out;
}

.wave-transition-text.boss-text {
  color: #ff4444;
  font-size: 2.5em;
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.8),
               0 0 40px rgba(255, 0, 0, 0.4),
               0 0 60px rgba(255, 0, 0, 0.2);
}

@keyframes wave-fade {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes wave-text-appear {
  0% { transform: scale(0.5); opacity: 0; }
  30% { transform: scale(1.2); opacity: 1; }
  50% { transform: scale(1); }
  100% { transform: scale(1); opacity: 1; }
}

/* Clone container positioning */
.clones-container {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  max-width: 200px;
}

/* Bottom Section - Combat Log & Global Actions (inside center column) */
.combat-bottom-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex-shrink: 0;
  height: 200px;
  background: rgba(10, 5, 20, 0.8);
  border-top: 2px solid rgba(218, 165, 32, 0.5);
  padding: 10px;
  z-index: 5;
}

.combat-global-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(10, 5, 20, 0.6);
  border: 2px solid rgba(138, 103, 255, 0.3);
  border-radius: 8px;
  padding: 10px;
  overflow-y: auto;
}

.bulk-action-btn {
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.85em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bulk-action-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.6);
  transform: translateY(-2px);
}

.bulk-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, #1a0f2e, #2a1f3e);
  border-color: #4a3a5a;
}

.combat-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  background: rgba(20, 10, 35, 0.5);
  border-radius: 4px;
  border: 1px solid rgba(138, 103, 255, 0.2);
}

.combat-option input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.combat-option label {
  cursor: pointer;
  color: #e8d4a0;
  font-size: 0.9em;
}

#submit-turn-button {
  padding: 16px 20px;
  font-family: inherit;
  font-size: 1.2em;
  background: linear-gradient(135deg, #c89020, #daa520);
  color: #1a0f2e;
  border: 3px solid #f4e4c1;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 6px;
  font-weight: bold;
  text-transform: uppercase;
  box-shadow: 0 0 25px rgba(218, 165, 32, 0.5);
}

#submit-turn-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  box-shadow: 0 0 35px rgba(218, 165, 32, 0.8);
  transform: translateY(-2px);
}

#submit-turn-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, #1a0f2e, #2a1f3e);
  border-color: #4a3a5a;
  box-shadow: none;
}

.log-header {
  font-weight: bold;
  color: #daa520;
  font-size: 1em;
  text-shadow: 0 0 10px #daa520;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(138, 103, 255, 0.3);
}

/* Formations - TOP */
.combat-formations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  padding: 15px;
  background: rgba(10, 5, 20, 0.6);
  border: 2px solid rgba(138, 103, 255, 0.3);
  border-radius: 8px;
  flex-shrink: 0;
}

.formation-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.formation-title {
  font-weight: bold;
  color: #daa520;
  font-size: 1.1em;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid #8a67ff;
}

.formation-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.party-formation .formation-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.enemy-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.enemy-lines .formation-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-label {
  min-width: 70px;
  padding: 6px 10px;
  background: rgba(138, 103, 255, 0.2);
  border: 1px solid #8a67ff;
  border-radius: 4px;
  font-size: 0.9em;
  color: #c9a870;
  text-align: center;
  font-weight: bold;
}

.front-row .row-label {
  background: rgba(218, 68, 83, 0.3);
  border-color: #da4453;
  color: #ff8a80;
}

.back-row .row-label {
  background: rgba(70, 130, 180, 0.3);
  border-color: #6a8caf;
  color: #87ceeb;
}

.combat-character-action {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
  transition: all 0.3s;
}

.combat-character-action:hover {
  background: rgba(20, 10, 35, 0.7);
  box-shadow: 0 0 10px rgba(138, 103, 255, 0.3);
}

.combat-character-action.completed {
  background: rgba(90, 58, 138, 0.3);
  border-color: #5a3a8a;
}

.combat-character-action.disabled {
  opacity: 0.5;
}

.combat-character-header {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.combat-char-portrait {
  width: 40px;
  height: 50px;
  border: 1px solid #8a67ff;
  object-fit: contain;
  background: #0a0612;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  border-radius: 2px;
}

.combat-character-info {
  flex: 1;
  min-width: 0;
}

.combat-char-name {
  font-weight: bold;
  font-size: 0.9em;
  color: #f4e4c1;
}

.combat-char-stats {
  font-size: 0.75em;
  line-height: 1.2;
  margin-top: 2px;
}

.combat-char-status {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  font-size: 0.7em;
}

.combat-actions-buttons {
  width: 100%;
  margin-top: 5px;
}

.combat-actions-buttons button {
  width: 100%;
  padding: 8px 4px;
  font-family: inherit;
  font-size: .75em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  border: 2px solid var(--character-color, #8a67ff);
  color: #f4e4c1;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.combat-actions-buttons button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(218, 165, 32, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.combat-actions-buttons button:hover:not(:disabled) {
  border-color: var(--character-color, #8a67ff);
  box-shadow: 0 0 15px var(--character-color, #8a67ff);
  background: linear-gradient(135deg, rgba(138, 103, 255, 0.3), rgba(138, 103, 255, 0.15));
  transform: translateY(-2px);
}

.combat-actions-buttons button:hover:not(:disabled)::before {
  width: 300px;
  height: 300px;
}

.combat-actions-buttons button.selected {
  background: linear-gradient(135deg, #daa520, #c89020);
  color: #1a0f2e;
  border-color: #f4e4c1;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.8);
  font-weight: 700;
}

/* Smaller font size only when button actually shows target info (spell/ability â†’ target) */
.combat-actions-buttons button.has-target {
  font-size: 0.55em;
}

.combat-actions-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, #1a0f2e, #2a1f3e);
  border-color: #4a3a5a;
}

/* Auto-attack indicator */
.auto-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(100, 100, 100, 0.6);
  color: #888;
  font-size: 9px;
  padding: 2px 4px;
  border-radius: 2px;
  cursor: pointer;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.3px;
  border: 1px solid rgba(136, 136, 136, 0.3);
  transition: all 0.2s ease;
  z-index: 10;
  pointer-events: auto;
  user-select: none;
}

.auto-indicator:hover {
  background: rgba(120, 120, 120, 0.8);
  color: #aaa;
  border-color: rgba(170, 170, 170, 0.5);
}

.auto-indicator.active {
  background: linear-gradient(135deg, #4a4, #3a3);
  color: #fff;
  border-color: #5f5;
  box-shadow: 0 0 8px rgba(68, 170, 68, 0.6);
  animation: auto-pulse 2s ease-in-out infinite;
}

.auto-indicator.active:hover {
  background: linear-gradient(135deg, #5a5, #4a4);
  box-shadow: 0 0 12px rgba(68, 170, 68, 0.8);
}

@keyframes auto-pulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(68, 170, 68, 0.6);
  }
  50% {
    box-shadow: 0 0 15px rgba(68, 170, 68, 0.9);
  }
}

.combat-target-select {
  width: 100%;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 0.8em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.3s;
}

.combat-target-select:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
}

.combat-target-select:focus {
  outline: none;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.7);
  border-color: #daa520;
}

.combat-target-buttons {
  display: flex;
  gap: 5px;
  width: 100%;
}

.combat-target-row-btn {
  flex: 1;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 0.8em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.3s;
  text-transform: uppercase;
}

.combat-target-row-btn:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  transform: translateY(-2px);
}

.combat-target-row-btn.active {
  background: linear-gradient(135deg, #daa520, #c89020);
  color: #1a0f2e;
  border-color: #f4e4c1;
  font-weight: bold;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.7);
}

.combat-center-view {
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow: hidden;
}

.enemy-lines-display {
  border: 1px solid #8a67ff;
  padding: 15px;
  background: rgba(10, 5, 20, 0.5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  max-height: 180px;
  border-radius: 4px;
}

.combat-settings {
  display: none;
}

.enemy-lines-display h3 {
  margin-bottom: 10px;
  color: #daa520;
}

.enemy-lines {
  display: flex;
  flex-direction: row;
  gap: 10px;
  justify-content: space-around;
}

.enemy-line {
  border: 1px solid #8a67ff;
  padding: 8px;
  background: rgba(10, 5, 20, 0.7);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex: 1;
  min-width: 0;
  border-radius: 4px;
}

.enemy-line:hover {
  background: rgba(61, 36, 99, 0.5);
  box-shadow: 0 0 10px rgba(138, 103, 255, 0.3);
  transform: translateY(-2px);
}

.enemy-line.selected {
  background: rgba(90, 58, 138, 0.6);
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
}

.line-header {
  font-weight: bold;
  margin-bottom: 5px;
  color: #daa520;
}

.enemy-group-list {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.enemy-line {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.enemy-group {
  margin: 0;
  padding: 2px 3px;
  background: rgba(138, 103, 255, 0.15);
  border: 1px solid rgba(138, 103, 255, 0.4);
  border-radius: 2px;
  font-size: 0.7em;
  white-space: nowrap;
  flex-shrink: 0;
  color: #c9a870;
}

.enemy-group.empty {
  color: #666;
  background: transparent;
  border: none;
}

.combat-log-section {
  border: 1px solid #8a67ff;
  padding: 15px;
  background: rgba(10, 5, 20, 0.5);
  overflow-y: auto;
  flex: 1;
  border-radius: 4px;
}

.combat-log-section h3 {
  margin-bottom: 10px;
  color: #daa520;
}

.combat-log {
  margin: 0;
  padding: 0;
  border: none;
  max-height: 120px;
  overflow-y: auto;
  font-size: 0.85em;
  line-height: 1.3;
}

.combat-log p {
  margin: 2px 0;
}

/* Old character actions styling - no longer used */
.character-actions-section {
  display: none;
}

.combat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding-top: 10px;
  border-top: 1px solid #8a67ff;
}

.combat-settings {
  display: flex;
  align-items: center;
}

.combat-settings label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.combat-settings input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.combat-actions button {
  padding: 12px 20px;
  font-family: inherit;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.combat-actions button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #daa520;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.6);
  transform: translateY(-2px);
}

.combat-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, #1a0f2e, #2a1f3e);
}

#submit-turn-button {
  flex: 0 0 auto;
  min-width: 150px;
  font-weight: bold;
  font-size: 1.1em;
  padding: 14px 24px;
  background: linear-gradient(135deg, #c89020, #daa520);
  border-color: #f4e4c1;
  box-shadow: 0 0 25px rgba(218, 165, 32, 0.5);
}

#submit-turn-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  box-shadow: 0 0 35px rgba(218, 165, 32, 0.8);
  transform: scale(1.05);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(10, 5, 20, 0.8);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #5a3a8a, #8a67ff);
  border: 1px solid #daa520;
  border-radius: 4px;
  transition: all 0.3s;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
}

/* Spell Selection Modal */
.spell-selection-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 18, 0.95);
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.spell-selection-modal.active {
  display: flex;
}

.spell-selection-container {
  border: 2px solid #daa520;
  padding: 20px;
  background: rgba(20, 10, 35, 0.98);
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.6);
  border-radius: 8px;
}

.spell-selection-container h3 {
  text-align: center;
  margin-bottom: 15px;
  color: #f4e4c1;
  text-shadow: 0 0 15px #daa520;
}

.spell-list-container {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spell-option {
  padding: 12px;
  border: 1px solid #8a67ff;
  background: rgba(61, 36, 99, 0.4);
  color: #e8d4a0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  transition: all 0.3s;
  text-align: left;
  border-radius: 4px;
  font-weight: 600;
}

.spell-option:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a3a8a, #8a67ff);
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
  transform: translateX(5px);
  color: #f4e4c1;
}

.spell-option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(60, 30, 30, 0.3);
  border-color: #8a4a4a;
  color: #999;
}

.spell-option-name {
  font-weight: bold;
  display: block;
}

.spell-option-details {
  font-size: 0.85em;
  color: #c9a870;
  margin-top: 3px;
}

.spell-modal-close {
  width: 100%;
  padding: 10px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.spell-modal-close:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
}

/* Ability Selection Modal */
.ability-selection-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 18, 0.95);
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.ability-selection-modal.active {
  display: flex;
}

.ability-selection-container {
  border: 2px solid #daa520;
  padding: 20px;
  background: rgba(20, 10, 35, 0.98);
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.6);
  border-radius: 8px;
}

.ability-selection-container h3 {
  text-align: center;
  margin-bottom: 15px;
  color: #f4e4c1;
  text-shadow: 0 0 15px #daa520;
}

.ability-list-container {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ability-option {
  padding: 12px;
  border: 1px solid #8a67ff;
  background: rgba(61, 36, 99, 0.4);
  color: #e8d4a0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  transition: all 0.3s;
  text-align: left;
  border-radius: 4px;
  font-weight: 600;
}

.ability-option:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a3a8a, #8a67ff);
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
  transform: translateX(5px);
  color: #f4e4c1;
}

.ability-option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(60, 30, 30, 0.3);
  border-color: #8a4a4a;
  color: #999;
}

.ability-option-name {
  font-weight: bold;
  display: block;
}

.ability-option-details {
  font-size: 0.85em;
  color: #c9a870;
  margin-top: 3px;
}

/* Combat Initiative Timeline Display */
.combat-timeline-display {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: 80%;
  height: 115px;
  background: rgba(20, 10, 35, 0.95);
  border: 2px solid #daa520;
  padding: 8px 15px;
  z-index: 1101;
  display: none;
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: 0 0 30px rgba(218, 165, 32, 0.5);
  border-radius: 8px;
}

.combat-timeline-display.active {
  display: block;
}

.timeline-header {
  display: none;
}

.timeline-header h3 {
  margin: 0;
  font-size: 1.1em;
  color: #0ff;
  text-shadow: 0 0 5px #0ff;
}

.current-tick {
  font-size: 0.9em;
  color: #ff0;
  font-weight: bold;
}

.timeline-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.timeline-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px;
  background: rgba(61, 36, 99, 0.5);
  border: 1px solid #8a67ff;
  border-radius: 3px;
  font-size: 0.75em;
  min-width: 60px;
}

.timeline-action.current {
  background: rgba(255, 255, 0, 0.2);
  border-color: #ff0;
  box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

.timeline-action.enemy-turn {
  background: rgba(255, 50, 50, 0.2);
  border-color: #f55;
}

.timeline-action.spell-casting {
  background: rgba(138, 43, 226, 0.25);
  border-color: #ff00ff;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
  animation: spell-pulse 2s ease-in-out infinite;
}

@keyframes spell-pulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.6);
  }
}

.timeline-action.spell-complete {
  background: rgba(100, 100, 255, 0.2);
  border-color: #88f;
}

/* Spell countdown badge on character portraits */
.spell-countdown-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(138, 43, 226, 0.95);
  border: 2px solid #ff00ff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #fff;
  font-size: 12px;
  z-index: 10;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.7);
  animation: countdown-pulse 1.5s ease-in-out infinite;
}

@keyframes countdown-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.timeline-position {
  font-weight: bold;
  color: #daa520;
  text-align: center;
  font-size: 0.7em;
  order: -1;
}

.timeline-portrait-container {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.timeline-portrait {
  width: 40px;
  height: 40px;
  border: 2px solid #8a67ff;
  border-radius: 4px;
  object-fit: cover;
  background-color: #0a0612;
}

.timeline-action.current .timeline-portrait {
  border-color: #ff0;
  box-shadow: 0 0 8px #ff0;
}

.timeline-enemy-icon {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: 2px solid #f55;
  border-radius: 4px;
  background: rgba(100, 20, 20, 0.5);
  z-index: 1;
}

.timeline-ct-gauge {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(to right, #0f0, #ff0, #f00);
  border-radius: 0 0 4px 4px;
  transition: width 0.3s ease;
  z-index: 2;
}

/* Timeline CT Bar - visible bar showing CT progress */
.timeline-ct-bar-outer {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #555;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 2px;
}

.timeline-ct-bar-inner {
  height: 100%;
  background: linear-gradient(to right, #4a9eff, #00ff88);
  transition: width 1s linear;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.timeline-ct-value {
  /* Hidden - CT is now shown as a bar */
  display: none;
}

.timeline-info {
  display: none;
}

.action-actor {
  color: #e8d4a0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: bold;
  font-size: 0.7em;
  max-width: 60px;
  text-align: center;
}

.action-type {
  color: #daa520;
  font-size: 0.65em;
}

/* Action Request Modal (Initiative Turn) */
.action-request-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 18, 0.98);
  justify-content: center;
  align-items: center;
  /* Above combat-effects-layer (1100) so tap events reach the buttons */
  z-index: 1200;
}

.action-request-modal.active {
  display: flex;
}

.action-request-content {
  border: 3px solid #daa520;
  padding: 25px;
  background: rgba(20, 10, 35, 0.98);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 0 50px rgba(218, 165, 32, 0.7);
  animation: modal-appear 0.3s ease-out;
  border-radius: 8px;
}

@keyframes modal-appear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.action-request-content h2 {
  text-align: center;
  margin-bottom: 10px;
  color: #f4e4c1;
  text-shadow: 0 0 15px #daa520;
}

.action-timer {
  text-align: center;
  font-size: 1.3em;
  font-weight: bold;
  color: #daa520;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
}

.action-options,
.target-options {
  margin-bottom: 20px;
}

.action-options h3,
.target-options h3 {
  color: #daa520;
  margin-bottom: 10px;
  font-size: 1.1em;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.action-btn,
.target-btn {
  padding: 12px;
  border: 2px solid #8a67ff;
  background: rgba(61, 36, 99, 0.6);
  color: #f4e4c1;
  cursor: pointer;
  font-family: inherit;
  font-size: 1em;
  transition: all 0.3s;
  text-align: center;
  border-radius: 4px;
  font-weight: 600;
  /* iOS: prevent double-tap zoom, ensure tap fires immediately */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(218,165,32,0.2);
  min-height: 48px;
  user-select: none;
  -webkit-user-select: none;
}

.action-btn:hover,
.target-btn:hover {
  background: linear-gradient(135deg, #5a3a8a, #8a67ff);
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  transform: scale(1.05);
}

.action-btn.selected,
.target-btn.selected {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #f4e4c1;
  font-weight: bold;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.7);
}

.target-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upcoming-actors {
  background: rgba(10, 5, 20, 0.5);
  padding: 12px;
  border: 1px solid #8a67ff;
  margin-bottom: 15px;
  border-radius: 4px;
}

.upcoming-actors h4 {
  color: #daa520;
  margin-bottom: 8px;
  font-size: 0.95em;
}

.upcoming-actors ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.upcoming-actors li {
  color: #e8d4a0;
  font-size: 0.9em;
  padding: 4px 0;
  border-bottom: 1px solid #4a3a5a;
}

.upcoming-actors li:last-child {
  border-bottom: none;
}

.submit-action-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #c89020, #daa520);
  border: 2px solid #f4e4c1;
  color: #1a0f2e;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  border-radius: 6px;
  min-height: 54px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(218,165,32,0.3);
}

.submit-action-btn:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  box-shadow: 0 0 35px rgba(218, 165, 32, 0.8);
  transform: translateY(-2px);
}

/* Casting Progress Bar (in character action cards) */
.casting-progress {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 100, 0, 0.2);
  border: 1px solid #f80;
  border-radius: 3px;
}

.casting-header {
  display: flex;
  justify-content: space-between;
  color: #f80;
  font-size: 0.9em;
  margin-bottom: 5px;
}

.casting-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #666;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.casting-fill {
  height: 100%;
  background: linear-gradient(90deg, #f80 0%, #ff0 100%);
  transition: width 0.3s ease-out;
  box-shadow: 0 0 10px #f80;
}

.casting-ticks {
  font-size: 0.85em;
  color: #ff0;
  text-align: center;
}

.ability-modal-close {
  width: 100%;
  padding: 10px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.ability-modal-close:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
}

.available-abilities {
  margin-top: 15px;
}

.available-abilities button {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 1px solid #8a67ff;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.available-abilities button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateX(5px);
}

.available-abilities button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Character Detail Modal */
.character-detail-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 18, 0.9);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.character-detail-modal.active {
  display: flex;
}

.character-detail-container {
  border: 2px solid #daa520;
  padding: 30px;
  background: rgba(20, 10, 35, 0.98);
  max-width: 1000px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.5);
  border-radius: 8px;
}

.character-detail-container h2 {
  text-align: center;
  margin-bottom: 20px;
  text-shadow: 0 0 15px #daa520;
  font-size: 1.8em;
  color: #f4e4c1;
}

.detail-section {
  margin-bottom: 25px;
  padding: 15px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.detail-section h3 {
  margin-bottom: 15px;
  color: #daa520;
  text-shadow: 0 0 8px rgba(218, 165, 32, 0.5);
}

.detail-section h4 {
  margin-top: 15px;
  margin-bottom: 10px;
  color: #c9a870;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(138, 103, 255, 0.2);
}

.detail-row span:first-child {
  font-weight: bold;
  color: #daa520;
}

.detail-row span:last-child {
  color: #e8d4a0;
}

.exp-bar {
  width: 100%;
  height: 20px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  margin-top: 10px;
  overflow: hidden;
  border-radius: 3px;
}

.exp-progress {
  height: 100%;
  background: linear-gradient(90deg, #5a3a8a, #8a67ff);
  transition: width 0.3s;
  width: 0%;
}

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

.stat-display {
  text-align: center;
  padding: 10px;
  border: 1px solid #8a67ff;
  background: rgba(20, 10, 35, 0.7);
  border-radius: 4px;
}

.stat-label {
  display: block;
  font-size: 0.8em;
  color: #c9a870;
  margin-bottom: 5px;
}

.stat-value {
  display: block;
  font-size: 1.3em;
  font-weight: bold;
  color: #f4e4c1;
}

.spells-list {
  padding: 10px;
  background: rgba(10, 5, 20, 0.5);
  border: 1px solid #8a67ff;
  border-radius: 4px;
  margin-bottom: 15px;
}

.spell-item {
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(61, 36, 99, 0.4);
  border-left: 3px solid #8a67ff;
  border-radius: 2px;
}

.spell-item-name {
  font-weight: bold;
  color: #daa520;
}

.spell-item-details {
  font-size: 0.9em;
  color: #c9a870;
  margin-top: 3px;
}

.ability-item {
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(61, 36, 99, 0.4);
  border-left: 3px solid #8a67ff;
  border-radius: 2px;
}

.ability-item-name {
  font-weight: bold;
  color: #daa520;
}

.ability-item-details {
  font-size: 0.9em;
  color: #c9a870;
  margin-top: 3px;
}

.available-spells {
  margin-top: 15px;
}

.available-spells button {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 1px solid #8a67ff;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.available-spells button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateX(5px);
}

.available-spells button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.detail-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.detail-action-bar button {
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.detail-action-bar button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
}

.detail-action-bar .detail-close-btn {
  margin-left: auto;
}

@media (max-width: 600px) {
  .detail-action-bar {
    gap: 6px;
  }
  .detail-action-bar button {
    padding: 7px 10px;
    font-size: 0.85em;
  }
  .detail-action-bar .detail-close-btn {
    margin-left: 0;
  }
}

/* 2-Column Layout for Skills Modal */
.skills-columns-wrapper,
.stats-columns-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

#detail-spellbook-section {
  grid-column: 1;
}

#detail-abilitybook-section {
  grid-column: 2;
}

/* Responsive adjustments for skills in narrow viewports */
@media (max-width: 1100px) {
  .skills-columns-wrapper,
  .stats-columns-wrapper {
    grid-template-columns: 1fr;
  }
  
  #detail-spellbook-section {
    grid-column: 1;
  }
  
  #detail-abilitybook-section {
    grid-column: 1;
  }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .game-container {
    grid-template-columns: 150px 1fr 150px;
    gap: 10px;
    padding: 10px;
  }
  
  .char-info {
    font-size: 0.75em;
  }
  
  .controls button {
    padding: 8px 15px;
    font-size: 0.85em;
    min-width: 70px;
  }
}

/* Inventory & Equipment Modal */
.inventory-container {
  background: rgba(20, 10, 35, 0.98);
  border: 3px solid #daa520;
  padding: 30px;
  max-width: 1200px;
  width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.5);
  border-radius: 8px;
}

.inventory-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 30px;
  margin: 20px 0;
}

.equipment-section h3,
.inventory-section h3 {
  color: #daa520;
  margin-bottom: 15px;
  font-size: 1.3em;
  text-shadow: 0 0 12px rgba(218, 165, 32, 0.6);
}

.equipment-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.equipment-slot {
  border: 2px solid #8a67ff;
  padding: 8px;
  background: rgba(10, 5, 20, 0.5);
  transition: all 0.3s;
  border-radius: 4px;
}

.equipment-slot:hover {
  border-color: #daa520;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.4);
}

.slot-label {
  font-size: 0.85em;
  color: #c9a870;
  margin-bottom: 5px;
  text-transform: uppercase;
  font-weight: 600;
}

.slot-content {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  cursor: pointer;
  padding: 5px;
  border-radius: 2px;
}

.slot-content:hover {
  background: rgba(90, 58, 138, 0.3);
  border-color: #daa520;
}

.empty-slot {
  color: #c9a870;
  opacity: 0.5;
  font-style: italic;
  font-size: 0.9em;
}

.equipped-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.equipped-item-name {
  font-weight: bold;
  color: #daa520;
  margin-bottom: 3px;
  font-size: 0.9em;
}

.equipped-item-stats {
  font-size: 0.75em;
  color: #c9a870;
}

.equipment-stats {
  border: 2px solid #8a67ff;
  padding: 15px;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.equipment-stats h4 {
  color: #daa520;
  margin-bottom: 10px;
  font-size: 1.1em;
}

.bonus-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(138, 103, 255, 0.2);
}

.bonus-row:last-child {
  border-bottom: none;
}

.bonus-row span:first-child {
  color: #c9a870;
}

.bonus-row span:last-child {
  color: #daa520;
  font-weight: bold;
}

.inventory-section h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#inventory-weight {
  font-size: 0.9em;
  color: #c9a870;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 500px;
  overflow-y: auto;
  padding: 10px;
  border: 2px solid #8a67ff;
  background: rgba(10, 5, 20, 0.3);
  border-radius: 4px;
}

.inventory-item {
  border: 2px solid #8a67ff;
  padding: 10px;
  background: rgba(20, 10, 35, 0.5);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  min-height: 100px;
  border-radius: 4px;
}

.inventory-item:hover {
  border-color: #daa520;
  background: rgba(90, 58, 138, 0.3);
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
  transform: translateY(-2px);
}

.inventory-item.consumable {
  border-color: #ff0;
}

.inventory-item.consumable:hover {
  border-color: #ff0;
  box-shadow: 0 0 15px rgba(255, 255, 0, 0.4);
}

.inventory-item-name {
  font-weight: bold;
  color: #daa520;
  margin-bottom: 5px;
  font-size: 0.95em;
}

.inventory-item-type {
  font-size: 0.75em;
  color: #c9a870;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.inventory-item-stats {
  font-size: 0.8em;
  color: #c9a870;
  margin-top: auto;
}

.inventory-item-quantity {
  position: absolute;
  top: 5px;
  right: 5px;
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.75em;
  font-weight: bold;
}

.inventory-item {
  position: relative;
}

.item-tier-starter { border-left: 3px solid #888; }
.item-tier-common { border-left: 3px solid #8a67ff; }
.item-tier-uncommon { border-left: 3px solid #4af; }
.item-tier-rare { border-left: 3px solid #b48; }
.item-tier-legendary { border-left: 3px solid #fa0; box-shadow: inset 0 0 8px rgba(255,170,0,0.15); }

/* Enchantment summary lines */
.enchant-line {
  padding: 3px 0;
  border-bottom: 1px solid rgba(218,165,32,0.15);
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.enchant-line:last-child { border-bottom: none; }
.enchant-slot {
  font-size: 0.78em;
  color: #888;
  text-transform: capitalize;
  min-width: 40px;
}

.inventory-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.inventory-actions button {
  padding: 12px 30px;
  font-family: inherit;
  font-size: 1em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.inventory-actions button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateY(-2px);
}

/* Item tooltip */
.item-tooltip {
  position: absolute;
  background: rgba(20, 10, 35, 0.98);
  border: 2px solid #daa520;
  padding: 10px;
  z-index: 10000;
  max-width: 300px;
  pointer-events: none;
  box-shadow: 0 0 25px rgba(218, 165, 32, 0.5);
  border-radius: 4px;
}

.item-tooltip-name {
  font-weight: bold;
  color: #f4e4c1;
  font-size: 1.1em;
  margin-bottom: 5px;
}

.item-tooltip-description {
  color: #c9a870;
  font-size: 0.9em;
  margin: 5px 0;
}

.item-tooltip-stats {
  color: #e8d4a0;
  font-size: 0.85em;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(138, 103, 255, 0.3);
}

@media (max-width: 1000px) {
  .inventory-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .inventory-container {
    width: 95vw;
    padding: 15px;
  }
}

/* Combat Visualization */
.combat-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 99vw;
  height: 98vh;
  padding: 8px;
  background: rgba(20, 10, 35, 0.98);
  border: 3px solid #8a67ff;
  box-shadow: 0 0 30px rgba(138, 103, 255, 0.5);
  overflow: hidden;
}

.combat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 2px solid #8a67ff;
  flex-shrink: 0;
  gap: 10px;
}

.combat-header h2 {
  margin: 0;
  text-shadow: 0 0 15px #daa520;
  font-size: 1.4em;
}

.turn-indicator {
  font-size: 1em;
  color: #daa520;
  font-weight: bold;
}

/* Formations - Horizontal layout on single line */
.combat-formations {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(20, 10, 35, 0.6);
  border: 2px solid rgba(138, 103, 255, 0.3);
  border-radius: 8px;
  flex-shrink: 0;
  height: auto;
  overflow-x: auto;
  overflow-y: hidden;
}

.formation-side {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.formation-divider {
  width: 2px;
  height: 60px;
  background: rgba(138, 103, 255, 0.5);
  flex-shrink: 0;
}

.clones-container {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: rgba(20, 10, 35, 0.6);
  border: 1px dashed #8a67ff;
  border-radius: 4px;
  min-height: 20px;
  flex-wrap: wrap;
  align-content: flex-start;
}

.clone-portrait {
  opacity: 0.8;
  border-color: #aa0 !important;
}

.formation-line {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.formation-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-label {
  min-width: 35px;
  padding: 3px 4px;
  background: rgba(138, 103, 255, 0.1);
  border: 1px solid #8a67ff;
  border-radius: 3px;
  font-size: 0.7em;
  color: #e8d4a0;
  text-align: center;
  font-weight: bold;
  flex-shrink: 0;
  white-space: nowrap;
}

.front-row .row-label {
  background: rgba(255, 107, 0, 0.2);
  border-color: #ff6b00;
  color: #ff6b00;
}

.back-row .row-label {
  background: rgba(0, 153, 255, 0.2);
  border-color: #0099ff;
  color: #0099ff;
}

.combat-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px;
  background: rgba(20, 10, 35, 0.5);
  border: 1px solid #8a67ff;
  border-radius: 4px;
  min-height: auto;
  flex: 1;
}

.combat-row-front {
  border-color: #ff6b00;
}

.combat-row-back {
  border-color: #0099ff;
}

/* Combat Main Area - Takes remaining space */
.combat-main {
  display: grid;
  grid-template-columns: 40% 60%;
  gap: 10px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.combat-log-section {
  display: flex;
  flex-direction: column;
  border: 2px solid #8a67ff;
  border-radius: 6px;
  background: rgba(20, 10, 35, 0.8);
  overflow: hidden;
  min-height: 0;
}

.log-header {
  padding: 4px 8px;
  background: rgba(138, 103, 255, 0.15);
  border-bottom: 1px solid #8a67ff;
  font-weight: bold;
  color: #e8d4a0;
  font-size: 0.8em;
}

.combat-log {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  font-size: 0.7em;
  line-height: 1.3;
  color: #e8d4a0;
}

.combat-log p {
  margin: 1px 0;
  padding: 0;
  word-wrap: break-word;
}

.action-selection-section {
  display: flex;
  flex-direction: column;
  border: 2px solid #8a67ff;
  border-radius: 6px;
  background: rgba(20, 10, 35, 0.8);
  overflow: hidden;
  min-height: 0;
}

.action-header {
  padding: 4px 8px;
  background: rgba(138, 103, 255, 0.15);
  border-bottom: 1px solid #8a67ff;
  font-weight: bold;
  color: #e8d4a0;
  font-size: 0.8em;
}

.character-actions-panel {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: auto;
  gap: 10px;
  height: 100%;
}

.action-phase-info {
  padding: 4px 6px;
  background: rgba(138, 103, 255, 0.1);
  border-top: 1px solid rgba(138, 103, 255, 0.3);
  font-size: 0.7em;
  color: #e8d4a0;
  text-align: center;
  font-style: italic;
  flex-shrink: 0;
}

/* Character Action Card */
.combat-character-action {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid #8a67ff;
  background: rgba(20, 10, 35, 0.7);
  border-radius: 3px;
  max-height: 280px;
}

.combat-character-action.completed {
  background: rgba(138, 103, 255, 0.2);
  opacity: 0.7;
}

.combat-character-action.disabled {
  opacity: 0.4;
  border-color: #333;
}

.combat-character-header {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 6px;
}

.combat-portrait-container {
  position: relative;
  display: inline-block;
  width: fit-content;
  transition: all 0.3s ease;
}

/* Active turn animation for big portraits */
.combat-portrait-container.active-turn {
  position: relative;
  animation: portrait-pulse 1.5s ease-in-out infinite;
}

.combat-portrait-container.active-turn::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 4px;
  background: linear-gradient(
    45deg,
    #ffd700,
    #ffed4e,
    #ffd700,
    #ff8c00,
    #ffd700,
    #ffed4e,
    #ffd700
  );
  background-size: 400% 400%;
  animation: border-rotate 3s linear infinite;
  z-index: -1;
  filter: blur(2px);
}

.combat-portrait-container.active-turn::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    #ffd700,
    #ffed4e,
    #ff8c00,
    #ffed4e,
    #ffd700
  );
  background-size: 300% 300%;
  animation: border-rotate 2s linear infinite reverse;
  z-index: -1;
}

@keyframes border-rotate {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes portrait-pulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.03);
    filter: brightness(1.15);
  }
}

/* Targeting mode styles */
.combat-portrait-container.targetable {
  cursor: pointer;
  animation: targetable-pulse-portrait 1.5s ease-in-out infinite;
}

.combat-portrait-container.targetable:hover .combat-char-portrait {
  border-color: #00ddff;
  box-shadow: 0 0 15px rgba(0, 221, 255, 0.7);
  transform: scale(1.05);
}

/* Visual confirmation when target is selected */
.combat-portrait-container.target-confirmed .combat-char-portrait {
  border-color: #8a67ff;
  box-shadow: 0 0 20px rgba(138, 103, 255, 0.9);
  animation: target-confirm 0.5s ease;
}

@keyframes targetable-pulse-portrait {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.3);
  }
}

@keyframes target-confirm {
  0% {
    box-shadow: 0 0 5px rgba(138, 103, 255, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(138, 103, 255, 1);
    transform: scale(1.1);
  }
  100% {
    box-shadow: 0 0 10px rgba(138, 103, 255, 0.7);
  }
}

.combat-char-portrait {
  width: 60px;
  height: 60px;
  border: 1px solid #8a67ff;
  object-fit: contain;
  background: #000;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  border-radius: 2px;
  display: block;
}

/* Status effect icons on portraits */
.portrait-status-icons {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  z-index: 5;
}

.status-icon {
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #8a67ff;
  border-radius: 2px;
  display: none; /* Hidden - using action-card-status-icon instead */
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: help;
  pointer-events: auto;
  position: relative;
}

.status-icon.buff {
  border-color: #4af;
  color: #4af;
}

.status-icon.debuff {
  border-color: #f44;
  color: #f44;
}

/* Tooltip for status icons */
.status-icon-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid #8a67ff;
  border-radius: 3px;
  padding: 6px 8px;
  min-width: 180px;
  max-width: 250px;
  font-size: 11px;
  line-height: 1.4;
  color: #e8d4a0;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10000;
}

.status-icon:hover .status-icon-tooltip {
  opacity: 1;
  visibility: visible;
}

.status-icon-tooltip .tooltip-title {
  font-weight: bold;
  margin-bottom: 4px;
  color: #4af;
}

.status-icon-tooltip.debuff .tooltip-title {
  color: #f44;
}

.status-icon-tooltip .tooltip-effect {
  margin-left: 4px;
  color: #8f8;
}

/* Action card status effects container (horizontal layout) */
.action-card-status-effects {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  min-height: 22px;
}

.action-card-status-icon {
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #8a67ff;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: help;
  pointer-events: auto;
  position: relative;
}

.action-card-status-icon.buff {
  border-color: #4af;
  color: #4af;
}

.action-card-status-icon.debuff {
  border-color: #f44;
  color: #f44;
}

/* Tooltip for action card status icons */
.action-card-status-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid #8a67ff;
  border-radius: 3px;
  padding: 6px 8px;
  min-width: 180px;
  max-width: 250px;
  font-size: 11px;
  line-height: 1.4;
  color: #e8d4a0;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10000;
}

.action-card-status-icon:hover .action-card-status-tooltip {
  opacity: 1;
  visibility: visible;
}

.action-card-status-tooltip .tooltip-title {
  font-weight: bold;
  margin-bottom: 4px;
  color: #4af;
}

.action-card-status-tooltip.debuff .tooltip-title {
  color: #f44;
}

.action-card-status-tooltip .tooltip-effect {
  margin-left: 4px;
  color: #8f8;
}

.action-card-status-tooltip.debuff .tooltip-effect {
  color: #f66;
}

/* Susanoo fire effect animation */
.susanoo-active {
  position: relative;
  animation: susanoo-pulse 2s ease-in-out infinite;
}

.susanoo-active::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border: 2px solid transparent;
  border-radius: 3px;
  pointer-events: none;
  animation: susanoo-fire 1.5s ease-in-out infinite;
  z-index: 1;
}

.susanoo-active::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 
    0 0 8px rgba(138, 43, 226, 0.6),
    0 0 15px rgba(138, 43, 226, 0.4),
    inset 0 0 8px rgba(138, 43, 226, 0.3);
  animation: susanoo-glow 2s ease-in-out infinite;
  z-index: 0;
}

@keyframes susanoo-fire {
  0%, 100% {
    border-color: rgba(138, 43, 226, 0.8);
    filter: brightness(1);
  }
  25% {
    border-color: rgba(75, 0, 130, 0.9);
    filter: brightness(1.2);
  }
  50% {
    border-color: rgba(138, 43, 226, 0.7);
    filter: brightness(0.9);
  }
  75% {
    border-color: rgba(148, 0, 211, 0.85);
    filter: brightness(1.1);
  }
}

@keyframes susanoo-glow {
  0%, 100% {
    box-shadow: 
      0 0 8px rgba(138, 43, 226, 0.6),
      0 0 15px rgba(138, 43, 226, 0.4),
      inset 0 0 8px rgba(138, 43, 226, 0.3);
  }
  50% {
    box-shadow: 
      0 0 12px rgba(138, 43, 226, 0.8),
      0 0 20px rgba(138, 43, 226, 0.5),
      inset 0 0 12px rgba(138, 43, 226, 0.4);
  }
}

@keyframes susanoo-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.combat-portrait-health-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 0, 0, 0.25);
  transition: height 0.3s ease;
  border-bottom: 1px solid #8a67ff;
  border-left: 1px solid #8a67ff;
  border-right: 1px solid #8a67ff;
  border-radius: 0 0 1px 1px;
}

.combat-character-info {
  flex: 1;
  min-width: 0;
}

.combat-char-name {
  font-weight: bold;
  font-size: 0.85em;
  color: #e8d4a0;
  margin: 0;
}

.combat-char-stats {
  font-size: 0.75em;
  line-height: 1.2;
  margin: 0 0 6px 0;
  color: #0c0;
}

.combat-char-status {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.status-icon {
  font-size: 0.65em;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-bottom: 6px;
}

.action-buttons button {
  padding: 6px 4px;
  font-size: 0.75em;
  background: rgba(138, 103, 255, 0.1);
  border: 1px solid #8a67ff;
  color: #e8d4a0;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s;
}

.action-buttons button:hover:not(:disabled) {
  background: rgba(138, 103, 255, 0.25);
  box-shadow: 0 0 8px rgba(138, 103, 255, 0.5);
}

.action-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auto Controls Footer (Bottom-Right of Character Card) */
.combat-auto-controls-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  background: rgba(138, 103, 255, 0.05);
  border-top: 1px solid rgba(138, 103, 255, 0.2);
  font-size: 0.7em;
  margin-top: auto;
}

.combat-auto-controls-footer input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #8a67ff;
}

.combat-auto-controls-footer label {
  cursor: pointer;
  color: #e8d4a0;
  white-space: nowrap;
  margin: 0;
}

/* Bulk Action Buttons */
.bulk-action-btn {
  padding: 6px 12px;
  font-size: 0.85em;
  background: rgba(138, 103, 255, 0.15);
  border: 1px solid #8a67ff;
  color: #e8d4a0;
  cursor: pointer;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  transition: all 0.2s;
  white-space: nowrap;
}

.bulk-action-btn:hover {
  background: rgba(138, 103, 255, 0.3);
  box-shadow: 0 0 12px rgba(138, 103, 255, 0.6);
  text-shadow: 0 0 8px #daa520;
}

.bulk-action-btn:active {
  background: rgba(138, 103, 255, 0.4);
  transform: scale(0.98);
}

/* Combat Footer */
.combat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-top: 2px solid #8a67ff;
  background: rgba(20, 10, 35, 0.6);
  flex-shrink: 0;
  gap: 10px;
}

.combat-options {
  display: flex;
  gap: 15px;
  flex: 1;
}

.combat-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.combat-option input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #8a67ff;
}

.combat-option label {
  cursor: pointer;
  color: #e8d4a0;
  font-weight: bold;
  font-size: 0.85em;
}

#submit-turn-button {
  padding: 8px 20px;
  font-size: 0.85em;
  font-weight: bold;
  background: rgba(138, 103, 255, 0.2);
  border: 2px solid #8a67ff;
  color: #f4e4c1;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  min-width: 120px;
}

#submit-turn-button:hover:not(:disabled) {
  background: rgba(138, 103, 255, 0.35);
  box-shadow: 0 0 15px rgba(138, 103, 255, 0.7);
  transform: scale(1.05);
}

#submit-turn-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.combat-row {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: flex-start;
  padding: 10px;
  background: rgba(20, 10, 35, 0.5);
  border: 2px solid #8a67ff;
  border-radius: 6px;
  min-height: auto;
  flex: 1;
}

.combat-row-front {
  border-color: #ff6b00;
  background: rgba(255, 107, 0, 0.1);
}

.combat-row-back {
  border-color: #0099ff;
  background: rgba(0, 153, 255, 0.1);
}

.combat-portrait {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid #8a67ff;
  border-radius: 3px;
  background: rgba(20, 10, 35, 0.8);
  min-width: 55px;
  transition: all 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.combat-portrait:hover {
  box-shadow: 0 0 10px #8a67ff;
  transform: scale(1.05);
}

.portrait-image {
  width: 40px;
  height: 40px;
  background-size: cover;
  background-position: center;
  border: 1px solid #8a67ff;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

/* Slash effect on portrait image only - bright white slash lines */
.portrait-image::after {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  right: -10%;
  bottom: -10%;
  background: 
    linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.95) 47%, rgba(255, 255, 255, 0.5) 49%, rgba(255, 255, 255, 0.95) 51%, transparent 63%),
    linear-gradient(125deg, transparent 40%, rgba(255, 200, 100, 0.8) 49%, transparent 58%);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transform: translateX(-120%) rotate(0deg) scaleX(0.3);
  filter: blur(0.5px);
}

.combat-portrait.hit-slash .portrait-image::after {
  animation: slash-swipe 350ms ease-out both;
}

@keyframes slash-swipe {
  0% { opacity: 0; transform: translateX(-120%) rotate(-5deg) scaleX(0.3); }
  20% { opacity: 1; transform: translateX(-20%) rotate(0deg) scaleX(1); }
  50% { opacity: 0.9; transform: translateX(30%) rotate(5deg) scaleX(1); }
  100% { opacity: 0; transform: translateX(130%) rotate(10deg) scaleX(0.5); }
}

.portrait-name {
  font-size: 0.65em;
  color: #e8d4a0;
  text-align: center;
  max-width: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portrait-hp {
  font-size: 0.65em;
  color: #e8d4a0;
  margin-top: 2px;
}

.hp-bar {
  width: 60px;
  height: 8px;
  background: #000;
  border: 1px solid #8a67ff;
  overflow: hidden;
  border-radius: 2px;
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff00, #00cc00);
  width: 100%;
  transition: width 0.3s ease;
}

/* Combat Portrait States */
.combat-portrait.highlight-attacker {
  box-shadow: 0 0 30px #fff, inset 0 0 20px rgba(255, 255, 255, 0.5);
  transform: scale(1.15) translateY(-5px);
  border-color: #fff;
  background: rgba(50, 50, 50, 0.9);
  animation: pulse-attacker 0.6s ease-out;
}

.combat-portrait.highlight-target {
  box-shadow: 0 0 30px #f00, inset 0 0 20px rgba(255, 0, 0, 0.5);
  transform: scale(1.15);
  border-color: #f00;
  background: rgba(50, 0, 0, 0.9);
  animation: pulse-target 0.6s ease-out;
}

.combat-portrait.dead {
  opacity: 0.5;
  filter: grayscale(100%) brightness(0.6);
  pointer-events: none;
  border-color: #666;
}

.combat-portrait.dead::after {
  content: 'âœ¦ DEAD âœ¦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #f00;
  font-weight: bold;
  font-size: 1.2em;
  text-shadow: 0 0 10px #f00;
}

/* Targeting Mode Styles */
body.targeting-mode {
  cursor: crosshair;
}

body.targeting-mode * {
  cursor: crosshair;
}

.combat-portrait.targetable {
  animation: targetable-pulse 1.5s ease-in-out infinite;
  border-color: #0ff;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
  cursor: crosshair !important;
}

.combat-portrait.targetable:hover {
  box-shadow: 0 0 25px #0ff;
  border-color: #0ff;
  transform: scale(1.15);
}

.enemy-portrait.targetable {
  cursor: pointer !important;
  animation: targetable-pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.enemy-portrait.targetable:hover {
  box-shadow: 0 0 25px #0ff;
  transform: scale(1.2);
}

.enemy-portrait.target-confirmed {
  animation: target-confirmed 0.5s ease-out;
  box-shadow: 0 0 30px #0f0;
}

@keyframes targetable-pulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
  }
}

.targeting-indicator {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 255, 255, 0.95);
  color: #000;
  padding: 10px 14px;
  border: 2px solid #0ff;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1em;
  z-index: 10000;
  animation: targeting-indicator-pulse 1s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90vw;
  white-space: nowrap;
}

.targeting-indicator-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.targeting-indicator-icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

.targeting-indicator-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.targeting-indicator-cancel {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(0,0,0,0.4);
  border-radius: 4px;
  color: #000;
  font-weight: bold;
  font-size: 0.85em;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.targeting-indicator-cancel:active {
  background: rgba(0,0,0,0.4);
}

/* Post-selection "action locked in" banner */
.targeting-locked-banner {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,200,0,0.92);
  color: #fff;
  padding: 10px 20px;
  border: 2px solid #0f0;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1em;
  z-index: 10000;
  box-shadow: 0 0 16px rgba(0,255,0,0.6);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: targeting-locked-fade 2.5s ease-out forwards;
  pointer-events: none;
}

@keyframes targeting-locked-fade {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  70%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

@keyframes targeting-indicator-pulse {
  0%, 100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.05);
  }
}

/* Damage Indicator */
.damage-indicator {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: #f00;
  font-weight: bold;
  font-size: 1.8em;
  text-shadow: 0 0 10px #f00, 0 0 20px rgba(255, 0, 0, 0.5);
  pointer-events: none;
  z-index: 10;
  animation: float-up 5s ease-out forwards;
}

.damage-indicator.critical {
  color: #ffff00;
  font-size: 2.2em;
  text-shadow: 0 0 15px #ffff00, 0 0 25px rgba(255, 255, 0, 0.7);
}

.damage-indicator.heal {
  color: #daa520;
  text-shadow: 0 0 10px #daa520, 0 0 20px rgba(218, 165, 32, 0.5);
}

/* Animations */
@keyframes float-up {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-50px);
  }
}

@keyframes pulse-attacker {
  0% {
    box-shadow: 0 0 10px #fff;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 40px #fff;
    transform: scale(1.2);
  }
  100% {
    box-shadow: 0 0 30px #fff;
    transform: scale(1.15) translateY(-5px);
  }
}

@keyframes pulse-target {
  0% {
    box-shadow: 0 0 10px #f00;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 40px #f00;
    transform: scale(1.2);
  }
  100% {
    box-shadow: 0 0 30px #f00;
    transform: scale(1.15);
  }
}

/* Auto-attack and Auto-target Checkboxes */
.combat-options {
  display: flex;
  gap: 15px;
  justify-content: center;
  padding: 15px;
  background: rgba(20, 10, 35, 0.8);
  border: 2px solid #8a67ff;
  border-radius: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.combat-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e8d4a0;
}

.combat-option input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #8a67ff;
}

.combat-option label {
  cursor: pointer;
  user-select: none;
}

.combat-option input[type="checkbox"]:checked + label {
  color: #ff0;
  text-shadow: 0 0 10px #ff0;
}

/* Chakra Bar Styling */
.chakra-bar {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 0, 0.2);
  border: 1px solid #ffff00;
  border-radius: 2px;
  margin-top: 2px;
  overflow: hidden;
}

.chakra-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffff00, #ffcc00);
  transition: width 0.3s ease;
}

.chakra-text {
  font-size: 0.65em;
  color: #ffff00;
  margin-top: 2px;
  display: block;
}

.portrait-chakra {
  margin-top: 2px;
  text-align: center;
}

/* Laptop/Medium screens (tablets, small laptops) */
@media (max-width: 1366px) {
  .combat-char-portrait {
    width: 36px;
    height: 52px;
  }
  
  .combat-character-action {
    min-height: 130px;
    padding: 8px;
  }
  
  .character-actions-panel {
    gap: 6px;
  }
}

/* Mobile Combat Layout */
@media (max-width: 768px) {
  .combat-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1.5fr;
  }
  
  .character-actions-panel {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 6px;
  }
  
  .combat-character-action {
    min-height: 120px;
    padding: 8px;
    gap: 4px;
  }
  
  .combat-char-portrait {
    width: 32px;
    height: 48px;
  }
  
  .combat-formations {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 5px;
  }
  
  .formation-divider {
    display: none;
  }
}
/* Grudges List Styling */
.grudges-list {
  padding: 10px;
  background: rgba(0, 10, 0, 0.5);
  border: 1px solid #f00;
  border-radius: 3px;
  max-height: 300px;
  overflow-y: auto;
}

.grudge-item {
  margin-bottom: 8px;
}

.grudge-item:hover {
  background: rgba(255, 0, 0, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════
   Elite / Champion Enemy Styles
   ═══════════════════════════════════════════════════════════════════ */

/* Glow and scale the sprite container */
.enemy-sprite-container.elite-enemy {
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.9))
          drop-shadow(0 0 16px rgba(255, 140, 0, 0.5));
  animation: elite-pulse 2.5s ease-in-out infinite;
}

@keyframes elite-pulse {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 16px rgba(255, 140, 0, 0.5)); }
  50%       { filter: drop-shadow(0 0 14px rgba(255, 215, 0, 1))  drop-shadow(0 0 28px rgba(255, 165, 0, 0.8)); }
}

/* Elite sprites are slightly larger than standard enemies */
.enemy-sprite-container.elite-enemy .elite-sprite {
  width: 112px;
  height: 112px;
}

/* Lightning badge in the top-left corner */
.elite-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 1em;
  line-height: 1;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 215, 0, 0.7);
  border-radius: 4px;
  padding: 1px 3px;
  pointer-events: none;
  z-index: 5;
  animation: badge-flicker 2s ease-in-out infinite alternate;
}

@keyframes badge-flicker {
  0%   { opacity: 0.85; }
  100% { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════
   Challenge Rating (CR) Selection Modal
   ═══════════════════════════════════════════════════════════════════ */

.cr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: cr-overlay-fade 0.2s ease-out;
}

@keyframes cr-overlay-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cr-modal {
  background: linear-gradient(160deg, #1a1a2e 0%, #16213e 60%, #0f0f1a 100%);
  border: 2px solid rgba(138, 103, 255, 0.55);
  border-radius: 12px;
  padding: 28px 24px 20px;
  width: min(420px, 92vw);
  box-shadow: 0 0 40px rgba(90, 50, 180, 0.4), 0 16px 48px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cr-modal-title {
  margin: 0 0 2px;
  font-size: 1.4em;
  font-weight: bold;
  color: #e8d5a0;
  text-align: center;
  letter-spacing: 1px;
}

.cr-modal-subtitle {
  margin: 0 0 6px;
  font-size: 0.85em;
  color: #8a9bbf;
  text-align: center;
}

.cr-tier-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  color: #d8cbb4;
  transition: all 0.2s;
}

.cr-tier-normal  { border-color: rgba(180, 180, 180, 0.35); }
.cr-tier-heroic  { border-color: rgba(255, 120, 50, 0.45); }
.cr-tier-legendary { border-color: rgba(160, 60, 220, 0.55); }

.cr-tier-btn:not(.cr-tier-locked):hover.cr-tier-normal  { background: rgba(200, 200, 200, 0.12); border-color: #aaa; }
.cr-tier-btn:not(.cr-tier-locked):hover.cr-tier-heroic  { background: rgba(255, 120, 50, 0.18); border-color: #ff7832; }
.cr-tier-btn:not(.cr-tier-locked):hover.cr-tier-legendary { background: rgba(160, 60, 220, 0.22); border-color: #c050ee; }

.cr-tier-btn.cr-tier-locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(60%);
}

.cr-tier-icon {
  font-size: 1.8em;
  flex-shrink: 0;
}

.cr-tier-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cr-tier-name {
  font-size: 1em;
  font-weight: bold;
  color: #f0e0b0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cr-tier-bonus {
  font-size: 0.75em;
  font-weight: normal;
  color: #7ecf7e;
  background: rgba(40, 100, 40, 0.35);
  border: 1px solid rgba(80, 160, 80, 0.4);
  border-radius: 4px;
  padding: 1px 6px;
}

.cr-tier-desc {
  margin: 0;
  font-size: 0.78em;
  color: #8a9bbf;
  line-height: 1.4;
}

.cr-cancel-btn {
  margin-top: 4px;
  padding: 8px;
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #6a7a8f;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s;
}

.cr-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #a0b0c0;
}

