/**
 * Player Profile Card Component Styles
 * 
 * Handles both mobile (fixed-position around screen) and desktop (in monsters panel) modes
 * Mobile: ≤1024px - Simple cards at screen edges
 * Desktop: >1024px - Full-featured cards in monsters panel
 */

/* =============================================================================
   MOBILE MODE STYLES (≤1024px)
   Fixed-position cards around screen edges
   ============================================================================= */

@media (max-width: 1024px) {
  /* Container for all mobile cards - initially hidden, shown by JavaScript after setup */
  .cmp-player-cards-mobile {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9500; /* Below unleash/modal screens (12000) and replay overlay (9999) */
  }

  /* Container for individual card + name label */
  .ppc-mobile-container {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
  }

  /* Position cards at specific screen locations */
  /* Equal spacing: Top at 8%, Middle centered between top and bottom, Bottom at calc(68% - 30px) */
  
  /* Top corner cards */
  .ppc-mobile-container--top-left {
    top: 8%;
    left: 8px;
  }

  .ppc-mobile-container--top-right {
    top: 8%;
    right: 8px;
  }

  /* Middle cards - positioned for even spacing */
  .ppc-mobile-container--top-left-title {
    top: 45%;
    left: 8px;
    transform: translateY(-50%);
  }

  .ppc-mobile-container--top-right-title {
    top: 45%;
    right: 8px;
    transform: translateY(-50%);
  }

  /* Bottom cards - positioned to avoid Background Dweller label */
  .ppc-mobile-container--bottom-left {
    top: calc(68% - 30px);
    left: 8px;
  }

  .ppc-mobile-container--bottom-right {
    top: calc(68% - 30px);
    right: 8px;
  }

  /* Mobile card base - horizontal rectangular layout */
  .ppc-mobile {
    position: relative;
    width: 120px;
    height: 60px;
    min-height: 60px;
    max-height: 60px;
    flex-shrink: 0;
    flex-grow: 0;
    pointer-events: auto;
    transition: all 0.3s ease;
    z-index: 9500;
    /* opacity removed - inherit from parent container */
  }

  /* Card inner container - horizontal layout with profile on left, stats on right */
  .ppc-mobile-inner {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Dark/black background */
    border: 2px solid #444; /* Dark gray border */
    border-radius: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: row; /* Normal order for left-side cards */
    align-items: center;
    gap: 6px; /* Increased gap between profile and stats */
    padding: 3px 6px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* opacity removed - inherit from parent */
    overflow: visible;
  }

  /* Mirror the layout for right-side cards */
  .ppc-mobile-container--top-right .ppc-mobile-inner,
  .ppc-mobile-container--top-right-title .ppc-mobile-inner,
  .ppc-mobile-container--bottom-right .ppc-mobile-inner {
    flex-direction: row-reverse; /* Reverse order: stats on left, profile on right */
  }

  /* Right-align stats for left-side cards */
  .ppc-mobile-container--top-left .ppc-mobile-stats,
  .ppc-mobile-container--top-left-title .ppc-mobile-stats,
  .ppc-mobile-container--bottom-left .ppc-mobile-stats {
    justify-content: flex-end;
  }

  /* Left-align stats for right-side cards */
  .ppc-mobile-container--top-right .ppc-mobile-stats,
  .ppc-mobile-container--top-right-title .ppc-mobile-stats,
  .ppc-mobile-container--bottom-right .ppc-mobile-stats {
    justify-content: flex-start;
  }

  .ppc-mobile-inner:hover,
  .ppc-mobile-inner:active {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    /* opacity removed - inherit from parent */
  }

  /* Monster profile image - square on left side, zoomed to show headshot */
  .ppc-mobile-profile {
    width: 40px;
    height: 40px;
    border-radius: 0;
    background-color: #fff;
    background-size: 150%;
    background-position: center 20%;
    border: 2px solid rgba(0,0,0,0.3);
    flex-shrink: 0;
  }

  /* Stats bar - 2x2 grid next to profile */
  .ppc-mobile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px 1px;
    flex: 0 0 auto;
    min-width: 0;
    width: 60px;
    padding-left: 4px;
  }

  /* Individual stat - horizontal row */
  .ppc-mobile-stat {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 8px;
    font-weight: 600;
    color: #fff;
    position: relative;
  }

  .ppc-stat-icon {
    font-size: 9px;
    flex-shrink: 0;
  }

  .ppc-stat-value {
    color: #fff;
    font-family: 'Bangers', cursive;
    font-size: 11px;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  }

  /* ============================================================================
     ACTIVE PLAYER INDICATOR - CRITICAL SOLUTION
     ============================================================================
     
     PROBLEM: The active indicator (die emoji in colored circle) needed to be
     positioned at the CORNER of player cards in mobile view, but flexbox 
     align-items: center kept forcing it to center vertically.
     
     FAILED APPROACHES:
     1. Using position: absolute on the indicator itself - didn't work because
        the indicator is a SIBLING (not child) of the card, so it couldn't 
        position relative to the card
     2. Using align-self: flex-start on the indicator - doesn't work on 
        position: absolute elements
     3. Using descendant selectors like .ppc-mobile .ppc-mobile-active-indicator
        - didn't work because indicator is a sibling, not descendant
     
     THE SOLUTION:
     We use the :has() pseudo-class to target the PARENT CONTAINER based on
     whether it contains an active card, then style the indicator (which is a 
     sibling of the card within that container).
     
     Pattern: .ppc-mobile-container:has(.ppc-mobile--active) .ppc-mobile-active-indicator
     
     This works because:
     - The container holds both the card AND the indicator as direct children
     - :has() lets us check if the card is active
     - We can then position the indicator absolutely within the container
     
     STYLING CHALLENGE:
     The circle needed to be SOLID COLORED (not just a border) with the monster's
     theme color as the background. Initially we tried border-top-color which 
     only colored one side. The solution was:
     - background: [monster color] for the solid fill
     - border-color: [darker shade] for the border
     - Both using !important to override the default white background
     
     RENDERING BUG:
     The circle was rendering as an OVAL because there was duplicate CSS from
     an old triangle implementation that set width: 0 and height: 0 with 
     transparent borders. Removing that CSS fixed the oval issue and made it
     a perfect circle.
     
     ============================================================================ */
  
  /* Active player indicator - circular badge positioned OUTSIDE card within container */
  .ppc-mobile-active-indicator {
    position: absolute;
    width: 24px;
    height: 24px;
    background: #fff; /* Default white, overridden by monster-specific rules below */
    border: 2px solid #000; /* Default black border, overridden by monster-specific rules below */
    border-radius: 50%; /* Make it circular */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9501;
    pointer-events: none; /* Don't interfere with card clicks */
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    align-self: flex-start; /* Don't let parent align-items: center affect this */
  }

  .ppc-mobile-active-indicator::before {
    content: '🎲';
    font-size: 12px;
    line-height: 1;
  }

  /* TOP CARDS: indicator positioned BELOW card (outside) */
  
  /* Top-left card: below card, to the right (toward screen center) */
  .ppc-mobile-container--top-left .ppc-mobile-active-indicator {
    top: 46px; /* Below the 60px card height */
    right: -6px; /* Slightly outside the card width */
    left: auto; /* Override any centering */
  }

  /* Top-left-title card: below card, to the right (toward screen center) */
  .ppc-mobile-container--top-left-title .ppc-mobile-active-indicator {
    top: 46px; /* Below the 60px card height */
    right: -6px; /* Slightly outside the card width */
    left: auto; /* Override any centering */
  }

  /* Top-right card: below card, to the left (toward screen center) */
  .ppc-mobile-container--top-right .ppc-mobile-active-indicator {
    top: 46px; /* Below the 60px card height */
    left: -6px; /* Slightly outside the card width */
    right: auto; /* Override any centering */
  }

  /* Top-right-title card: below card, to the left (toward screen center) */
  .ppc-mobile-container--top-right-title .ppc-mobile-active-indicator {
    top: 46px; /* Below the 60px card height */
    left: -6px; /* Slightly outside the card width */
    right: auto; /* Override any centering */
  }

  /* BOTTOM CARDS: indicator positioned ABOVE card (overlapping) */

  /* Bottom-left card: top-right corner (toward screen center) */
  .ppc-mobile-container--bottom-left .ppc-mobile-active-indicator {
    top: -6px; /* Above the card */
    right: -6px; /* Slightly outside the card width */
    left: auto; /* Override any centering */
  }

  /* Bottom-right card: top-left corner (toward screen center) */
  .ppc-mobile-container--bottom-right .ppc-mobile-active-indicator {
    top: -6px; /* Above the card */
    left: -6px; /* Slightly outside the card width */
    right: auto; /* Override any centering */
  }

  /* Hide active indicator for empty cards */
  .ppc-mobile--empty .ppc-mobile-active-indicator {
    display: none;
  }

  /* Eliminated player styling */
  .ppc-mobile--eliminated {
    opacity: 0.5;
    filter: grayscale(80%);
    pointer-events: none;
  }

  .ppc-mobile--eliminated .ppc-mobile-inner {
    border-color: #666;
    cursor: default;
  }

  .ppc-mobile--eliminated .ppc-mobile-inner:hover,
  .ppc-mobile--eliminated .ppc-mobile-inner:active {
    transform: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  }

  /* Empty slot styling */
  .ppc-mobile--empty {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(1) brightness(0.7);
  }

  .ppc-mobile:not(.ppc-mobile--empty) {
    /* opacity removed - inherit from parent container */
    filter: none;
  }

  .ppc-mobile--empty .ppc-mobile-inner {
    background: #555 !important;
    border-color: rgba(255,255,255,0.15) !important;
    border-width: 1px !important;
    border-style: dashed !important;
  }

  .ppc-mobile--empty .ppc-mobile-profile {
    background: #444 !important;
    border-color: rgba(255,255,255,0.1) !important;
    opacity: 0.6;
  }

  .ppc-mobile--empty .ppc-stat-value,
  .ppc-mobile--empty .ppc-stat-icon {
    opacity: 0.3;
    color: #888 !important;
  }

  /* Scenario indicators */
  .ppc-scenario-indicator {
    color: #ff4444;
    font-size: 10px;
    margin-left: 2px;
  }

  /* Active player highlight - Monster-themed colors */
  
  /* The King active - #c49b3a (golden/orange) */
  .ppc-mobile--active[data-monster="the_king"] {
    filter: drop-shadow(0 0 30px rgba(196, 155, 58, 0.8)) 
            drop-shadow(0 0 60px rgba(196, 155, 58, 0.6))
            drop-shadow(0 0 100px rgba(196, 155, 58, 0.3));
  }
  .ppc-mobile--active[data-monster="the_king"] .ppc-mobile-inner {
    border: 3px solid #c49b3a !important;
    box-shadow: 0 0 8px rgba(196, 155, 58, 0.6), 0 2px 6px rgba(0,0,0,0.4);
  }
  .ppc-mobile--active[data-monster="the_king"]::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(196, 155, 58, 0.4) 0%, rgba(196, 155, 58, 0.2) 50%, transparent 80%);
    z-index: -1; border-radius: 20px;
  }
  .ppc-mobile-container:has(.ppc-mobile--active[data-monster="the_king"]) .ppc-mobile-active-indicator {
    background: #c49b3a !important;
    border-color: #9a7a2d !important;
  }

  /* Alienoid active - #c7d84a (yellow-green/lime) */
  .ppc-mobile--active[data-monster="alienoid"] {
    filter: drop-shadow(0 0 30px rgba(199, 216, 74, 0.8)) 
            drop-shadow(0 0 60px rgba(199, 216, 74, 0.6))
            drop-shadow(0 0 100px rgba(199, 216, 74, 0.3));
  }
  .ppc-mobile--active[data-monster="alienoid"] .ppc-mobile-inner {
    border: 3px solid #c7d84a !important;
    box-shadow: 0 0 8px rgba(199, 216, 74, 0.6), 0 2px 6px rgba(0,0,0,0.4);
  }
  .ppc-mobile--active[data-monster="alienoid"]::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(199, 216, 74, 0.4) 0%, rgba(199, 216, 74, 0.2) 50%, transparent 80%);
    z-index: -1; border-radius: 20px;
  }
  .ppc-mobile-container:has(.ppc-mobile--active[data-monster="alienoid"]) .ppc-mobile-active-indicator {
    background: #c7d84a !important;
    border-color: #9fb038 !important;
  }

  /* Kraken active - #2e8cba (blue) */
  .ppc-mobile--active[data-monster="kraken"] {
    filter: drop-shadow(0 0 30px rgba(46, 140, 186, 0.8)) 
            drop-shadow(0 0 60px rgba(46, 140, 186, 0.6))
            drop-shadow(0 0 100px rgba(46, 140, 186, 0.3));
  }
  .ppc-mobile--active[data-monster="kraken"] .ppc-mobile-inner {
    border: 3px solid #2e8cba !important;
    box-shadow: 0 0 8px rgba(46, 140, 186, 0.6), 0 2px 6px rgba(0,0,0,0.4);
  }
  .ppc-mobile--active[data-monster="kraken"]::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(46, 140, 186, 0.4) 0%, rgba(46, 140, 186, 0.2) 50%, transparent 80%);
    z-index: -1; border-radius: 20px;
  }
  .ppc-mobile-container:has(.ppc-mobile--active[data-monster="kraken"]) .ppc-mobile-active-indicator {
    background: #2e8cba !important;
    border-color: #236d94 !important;
  }

  /* Meka Dragon active - #d4473a (red) */
  .ppc-mobile--active[data-monster="meka_dragon"] {
    filter: drop-shadow(0 0 30px rgba(212, 71, 58, 0.8)) 
            drop-shadow(0 0 60px rgba(212, 71, 58, 0.6))
            drop-shadow(0 0 100px rgba(212, 71, 58, 0.3));
  }
  .ppc-mobile--active[data-monster="meka_dragon"] .ppc-mobile-inner {
    border: 3px solid #d4473a !important;
    box-shadow: 0 0 8px rgba(212, 71, 58, 0.6), 0 2px 6px rgba(0,0,0,0.4);
  }
  .ppc-mobile--active[data-monster="meka_dragon"]::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(212, 71, 58, 0.4) 0%, rgba(212, 71, 58, 0.2) 50%, transparent 80%);
    z-index: -1; border-radius: 20px;
  }
  .ppc-mobile-container:has(.ppc-mobile--active[data-monster="meka_dragon"]) .ppc-mobile-active-indicator {
    background: #d4473a !important;
    border-color: #a9382e !important;
  }

  /* Cyber Kitty active - #ff7ab8 (pink) */
  .ppc-mobile--active[data-monster="cyber_kitty"] {
    filter: drop-shadow(0 0 30px rgba(255, 122, 184, 0.8)) 
            drop-shadow(0 0 60px rgba(255, 122, 184, 0.6))
            drop-shadow(0 0 100px rgba(255, 122, 184, 0.3));
  }
  .ppc-mobile--active[data-monster="cyber_kitty"] .ppc-mobile-inner {
    border: 3px solid #ff7ab8 !important;
    box-shadow: 0 0 8px rgba(255, 122, 184, 0.6), 0 2px 6px rgba(0,0,0,0.4);
  }
  .ppc-mobile--active[data-monster="cyber_kitty"]::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(255, 122, 184, 0.4) 0%, rgba(255, 122, 184, 0.2) 50%, transparent 80%);
    z-index: -1; border-radius: 20px;
  }
  .ppc-mobile-container:has(.ppc-mobile--active[data-monster="cyber_kitty"]) .ppc-mobile-active-indicator {
    background: #ff7ab8 !important;
    border-color: #cc6293 !important;
  }

  /* Space Penguin active - #8ed1f0 (light blue) */
  .ppc-mobile--active[data-monster="space_penguin"] {
    filter: drop-shadow(0 0 30px rgba(142, 209, 240, 0.8)) 
            drop-shadow(0 0 60px rgba(142, 209, 240, 0.6))
            drop-shadow(0 0 100px rgba(142, 209, 240, 0.3));
  }
  .ppc-mobile--active[data-monster="space_penguin"] .ppc-mobile-inner {
    border: 3px solid #8ed1f0 !important;
    box-shadow: 0 0 8px rgba(142, 209, 240, 0.6), 0 2px 6px rgba(0,0,0,0.4);
  }
  .ppc-mobile--active[data-monster="space_penguin"]::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(142, 209, 240, 0.4) 0%, rgba(142, 209, 240, 0.2) 50%, transparent 80%);
    z-index: -1; border-radius: 20px;
  }
  .ppc-mobile-container:has(.ppc-mobile--active[data-monster="space_penguin"]) .ppc-mobile-active-indicator {
    background: #8ed1f0 !important;
    border-color: #6fb5d1 !important;
  }

  /* Gigazaur active - #5fa047 (green) */
  .ppc-mobile--active[data-monster="gigazaur"] {
    filter: drop-shadow(0 0 30px rgba(95, 160, 71, 0.8)) 
            drop-shadow(0 0 60px rgba(95, 160, 71, 0.6))
            drop-shadow(0 0 100px rgba(95, 160, 71, 0.3));
  }
  .ppc-mobile--active[data-monster="gigazaur"] .ppc-mobile-inner {
    border: 3px solid #5fa047 !important;
    box-shadow: 0 0 8px rgba(95, 160, 71, 0.6), 0 2px 6px rgba(0,0,0,0.4);
  }
  .ppc-mobile--active[data-monster="gigazaur"]::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(95, 160, 71, 0.4) 0%, rgba(95, 160, 71, 0.2) 50%, transparent 80%);
    z-index: -1; border-radius: 20px;
  }
  .ppc-mobile-container:has(.ppc-mobile--active[data-monster="gigazaur"]) .ppc-mobile-active-indicator {
    background: #5fa047 !important;
    border-color: #4c8038 !important;
  }

  /* Fallback for unmatched monsters - use yellow as default */
  .ppc-mobile--active:not([data-monster="the_king"]):not([data-monster="alienoid"]):not([data-monster="kraken"]):not([data-monster="meka_dragon"]):not([data-monster="cyber_kitty"]):not([data-monster="space_penguin"]):not([data-monster="gigazaur"]) {
    filter: drop-shadow(0 0 30px rgba(255, 207, 51, 0.8)) 
            drop-shadow(0 0 60px rgba(255, 207, 51, 0.6))
            drop-shadow(0 0 100px rgba(255, 207, 51, 0.3));
  }
  .ppc-mobile--active:not([data-monster="the_king"]):not([data-monster="alienoid"]):not([data-monster="kraken"]):not([data-monster="meka_dragon"]):not([data-monster="cyber_kitty"]):not([data-monster="space_penguin"]):not([data-monster="gigazaur"]) .ppc-mobile-inner {
    border: 3px solid #ffcf33 !important;
    box-shadow: 0 0 8px rgba(255, 207, 51, 0.6), 0 2px 6px rgba(0,0,0,0.4);
  }
  .ppc-mobile--active:not([data-monster="the_king"]):not([data-monster="alienoid"]):not([data-monster="kraken"]):not([data-monster="meka_dragon"]):not([data-monster="cyber_kitty"]):not([data-monster="space_penguin"]):not([data-monster="gigazaur"])::before {
    content: '';
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(ellipse at center, rgba(255, 207, 51, 0.4) 0%, rgba(255, 207, 51, 0.2) 50%, transparent 80%);
    z-index: -1; border-radius: 20px;
  }
  .ppc-mobile-container:has(.ppc-mobile--active:not([data-monster])) .ppc-mobile-active-indicator {
    background: #ffcf33 !important;
    border-color: #cca729 !important;
  }

  /* Player name label */
  .ppc-mobile-name {
    font-family: 'Bangers', cursive;
    font-size: 12px;
    color: #ffefa5;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    margin-top: 4px;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  .ppc-mobile-name--active {
    color: #fff;
    text-shadow: 0 0 4px #ffefa5, 1px 1px 2px rgba(0,0,0,0.8);
  }

  .ppc-mobile-name--empty {
    color: #888;
    opacity: 0.6;
    font-style: italic;
  }

  .ppc-mobile-name .cpu-label {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.8;
  }

  /* Mobile tombstone styles */
  .ppc-mobile.is-tombstone {
    pointer-events: none;
  }

  .ppc-mobile.is-tombstone .ppc-mobile-inner {
    background: linear-gradient(135deg, #555 0%, #333 100%) !important;
    border-color: #666 !important;
    filter: grayscale(1) brightness(0.6);
    position: relative;
  }

  .ppc-mobile.is-tombstone .ppc-mobile-avatar {
    filter: grayscale(1) brightness(0.7);
    opacity: 0.5;
  }

  /* Hide stats and replace with tombstone icon */
  .ppc-mobile.is-tombstone .ppc-mobile-stats {
    display: none;
  }

  /* Tombstone icon in stats area */
  .ppc-mobile.is-tombstone .ppc-mobile-inner::after {
    content: '🪦';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    opacity: 0.7;
    animation: tombstoneFadeIn 0.8s ease-out;
  }

  @keyframes tombstoneFadeIn {
    0% {
      opacity: 0;
      transform: translateY(-40%) scale(0.5);
    }
    100% {
      opacity: 0.7;
      transform: translateY(-50%) scale(1);
    }
  }

  /* Dim the name label */
  .ppc-mobile-container.is-tombstone .ppc-mobile-name {
    opacity: 0.5;
    text-decoration: line-through;
  }
}

/* =============================================================================
   DESKTOP MODE STYLES (>1024px)
   Full-featured cards in monsters panel
   ============================================================================= */

@media (min-width: 1025px) {
  /* Hide mobile container on desktop */
  .cmp-player-cards-mobile {
    display: none;
  }

  /* Desktop card base - matches original player-profile-card styling */
  .cmp-player-profile-card {
    position: relative;
    width: 280px;
    max-width: 100%; /* Prevent overflow in narrow containers */
    height: auto;
    font-family: 'Bangers', cursive;
    letter-spacing: 1px;
    color: #fff;
    --ppc-avatar-pos-y: 18%;
    flex-shrink: 0;
    box-sizing: border-box;
    perspective: 1000px; /* Enable 3D space for flip effect */
  }
  
  /* Card inner wrapper for flip animation */
  .ppc-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
  }
  
  /* Flip the card when data-flipped attribute is present */
  .cmp-player-profile-card[data-flipped] .ppc-card-inner {
    transform: rotateY(180deg);
  }
  
  /* Front and back faces */
  .ppc-card-front,
  .ppc-card-back {
    position: relative;
    width: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  /* Front side - normal card styling */
  .ppc-card-front {
    background: linear-gradient(135deg, var(--ppc-accent, #2d3436) 0%, #1b1f20 100%);
    border: 3px solid #000;
    border-radius: 4px;
    padding: 12px 16px 16px;
    box-shadow: 4px 4px 0 #000, 0 0 0 2px #222 inset;
    overflow: hidden;
  }
  
  /* Back side - full monster image */
  .ppc-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotateY(180deg);
    background: #000;
    color: #fff; /* White text for back side by default */
    border: 3px solid #000;
    border-radius: 4px;
    box-shadow: 4px 4px 0 #000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
  
  /* Back image fills the card */
  .ppc-back-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center 18%;
    background-repeat: no-repeat;
  }
  
  /* Flip back button in top left corner */
  .ppc-flip-back-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #000;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
  }
  
  .ppc-flip-back-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.6);
  }
  
  .ppc-flip-back-btn:active {
    transform: scale(0.95);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  }
  
  .flip-back-arrow {
    font-size: 20px;
    font-weight: bold;
    color: #000;
    line-height: 1;
  }
  
  /* Overlay with name and traits button */
  .ppc-back-overlay {
    position: relative;
    z-index: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
    padding: 20px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  /* Monster name on back */
  .ppc-back-name {
    font-size: 28px;
    text-align: center;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    color: var(--ppc-accent, #ffd400);
  }
  
  /* Character traits button */
  .ppc-traits-link {
    background: linear-gradient(135deg, #ffd400 0%, #ffb700 100%);
    border: 3px solid #000;
    border-radius: 4px;
    padding: 12px 16px;
    font-family: 'Bangers', cursive;
    font-size: 18px;
    letter-spacing: 1px;
    color: #000 !important; /* Black text on yellow background */
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  
  .ppc-traits-link:hover {
    transform: translateY(-2px);
    box-shadow: 3px 3px 0 #000;
    background: linear-gradient(135deg, #ffe04d 0%, #ffc020 100%);
  }
  
  .ppc-traits-link:active {
    transform: translateY(0);
    box-shadow: 1px 1px 0 #000;
  }
  
  .traits-icon {
    font-size: 20px;
  }

  .cmp-player-profile-card + .cmp-player-profile-card {
    margin-top: 8px; /* Reduced for tighter spacing, better viewport usage */
  }

  .cmp-player-profile-card.is-active {
    outline: 3px solid #ffd400;
    outline-offset: 3px;
  }

  /* Active player styling */
  .cmp-player-profile-card[data-active="true"] {
    outline: 3px solid #ffd400;
    outline-offset: 5px;
  }

  /* Header section */
  .ppc-header {
    display: flex;
    align-items: flex-start;
    margin: 0 0 14px;
    position: relative;
    pointer-events: auto;
  }

  /* Monster avatar */
  .ppc-avatar {
    width: 58px;
    height: 58px;
    border: 3px solid #000;
    border-radius: 50%;
    background: #fff center var(--ppc-avatar-pos-y)/cover no-repeat;
    box-shadow: 2px 2px 0 #000;
    margin-right: 10px;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    flex: 0 0 58px;
  }

  .ppc-avatar:hover {
    transform: scale(1.05);
    box-shadow: 3px 3px 0 #000, 0 0 0 2px #ffd400;
  }

  /* Meta section (name + status) */
  .ppc-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .ppc-name {
    font-size: 30px;
    line-height: 1;
    margin: 0 0 6px;
    padding-right: 8px;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    position: relative;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .ppc-status-line {
    display: flex;
    gap: 8px;
    font-size: 12px;
    align-items: center;
  }

  .ppc-active-indicator {
    color: #ffd400;
    font-size: 18px;
  }

  /* Tokyo indicator */
  .ppc-tokyo-indicator {
    display: inline-flex;
    margin-top: 4px;
    font-weight: 600;
    font-family: 'Bangers', cursive;
    background: #0b435c;
    color: #fff;
    padding: 6px 12px 6px;
    font-size: clamp(10px, 2.2vw, 14px);
    text-transform: lowercase;
    border-radius: 4px;
    letter-spacing: 0.5px;
  }

  /* CPU indicator */
  .ppc-cpu {
    display: inline-block;
    font-size: 20px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 1px;
    font-family: 'Bangers', cursive;
    color: #fff;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    margin-left: 8px;
  }

  /* Expand/collapse toggle for list view */
  .ppc-expand-toggle {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    z-index: 100;
    background: transparent !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 4px;
    transition: opacity 0.2s ease;
    opacity: 0.8;
  }

  /* Cards in monsters panel should fill full width */
  .cmp-monsters-panel .cmp-player-profile-card {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Show expand toggle in list view */
  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card {
    position: relative;
  }

  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card .ppc-expand-toggle {
    display: block !important;
  }

  .ppc-expand-toggle:hover {
    opacity: 1;
  }

  .ppc-expand-icon {
    display: block;
    transition: transform 0.3s ease;
    color: #fff;
    width: 16px;
    height: 10px;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.8));
  }

  /* Adjust header in list view */
  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card .ppc-header {
    margin-bottom: 12px;
    padding-right: 20px;
  }

  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card .ppc-name {
    margin-left: -4px;
    padding-right: 4px;
    font-size: 24px;
    line-height: 1.1;
  }

  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card .ppc-status-line {
    font-size: 11px;
  }

  /* Ensure stats stay horizontal in list view */
  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card .ppc-stats {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }

  /* Hide stats and health sections in list view by default (collapsed) */
  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card .ppc-stats,
  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card .ppc-health-block,
  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card .ppc-owned-cards {
    display: none;
  }

  /* Show stats and health when expanded in list view */
  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card[data-expanded] .ppc-stats {
    display: flex !important;
  }

  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card[data-expanded] .ppc-health-block,
  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card[data-expanded] .ppc-owned-cards {
    display: block;
  }

  /* Stats section */
  .ppc-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: nowrap;
    overflow: hidden;
    box-sizing: border-box;
    max-width: 100%;
    pointer-events: auto;
  }

  .ppc-stat {
    flex: 1;
    background: #fafafa;
    color: #111;
    border: 3px solid #000;
    border-radius: 0;
    padding: 8px 4px 6px;
    text-align: center;
    box-shadow: 2px 2px 0 #000;
    font-family: 'Bangers', cursive;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
    min-width: 0;
    box-sizing: border-box;
    pointer-events: auto;
  }

  .ppc-stat:hover {
    transform: scale(1.05);
  }

  .ppc-stat .label {
    display: block;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: #222;
    margin: 0 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ppc-stat .value {
    display: block;
    font-family: 'Bangers', cursive;
    font-size: 28px;
    color: #ffd400;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    line-height: 1;
  }

  /* Yellow value for all stats */
  .ppc-stat.energy .value,
  .ppc-stat.vp .value,
  .ppc-stat.cards .value {
    color: #ffd400;
  }

  /* Hide energy bolt and VP coin icons */
  .ppc-stat .energy-bolt,
  .ppc-stat .vp-coin {
    display: none;
  }

  /* Scenario indicators (red asterisks) */
  .scenario-indicator {
    display: none; /* Hidden by default, shown via JS with inline style */
    visibility: visible; /* Always visible when display is not none */
    position: absolute;
    bottom: 1px; /* 1px from bottom for stats */
    right: 5px; /* 5px from right for stats */
    color: #ff3333;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    pointer-events: auto;
    cursor: help;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
    z-index: 10;
    transition: transform 0.15s ease, filter 0.15s ease;
  }

  .scenario-indicator:hover {
    transform: scale(1.2);
    filter: brightness(1.3);
  }

  /* Health block indicator positioned at bottom of health block */
  .ppc-health-block .scenario-indicator {
    position: absolute;
    bottom: 45px; /* 45px from bottom of health block */
    right: 5px;
    font-size: 12px;
  }

  /* Health block */
  .ppc-health-block {
    background: #fff;
    border: 3px solid #000;
    box-shadow: 2px 2px 0 #000;
    padding: 6px 10px 10px;
    margin-top: 10px;
    margin-bottom: 12px;
    position: relative;
  }

  .ppc-health-label {
    font-family: 'Bangers', cursive;
    font-size: 20px;
    color: #000;
    font-weight: bold;
    margin: 0 0 6px;
    text-transform: none;
    letter-spacing: 0;
    text-shadow: none;
    position: relative;
  }

  .ppc-health-bar {
    position: relative;
    background: #222;
    border: 3px solid #000;
    height: 20px;
    overflow: visible; /* Changed from hidden to allow heart icon to show */
  }

  .ppc-health-bar .fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3ad65c, #129b37);
    transition: width 0.35s ease;
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  }

  .ppc-health-bar[data-low="true"] .fill {
    background: linear-gradient(90deg, #ff4d3d, #b30000);
  }

  /* Owned cards section */
  .ppc-owned-cards {
    padding-top: 10px;
    border-top: 2px solid rgba(0, 0, 0, 0.3);
    margin-top: 4px;
    overflow: hidden;
    box-sizing: border-box;
    max-width: 100%;
  }

  .ppc-owned-cards[hidden] {
    display: none;
  }

  .ppc-owned-cards-label {
    font-family: 'Bangers', cursive;
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .ppc-owned-cards-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow: hidden;
    box-sizing: border-box;
    max-width: 100%;
  }

  /* Card mini preview */
  .ppc-card-mini {
    width: 56px;
    height: 76px;
    background: linear-gradient(135deg, #2d3436 0%, #1b1f20 100%);
    border: 2px solid #000;
    border-radius: 2px;
    padding: 4px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 2px 0 #000;
  }

  .ppc-card-mini:hover {
    transform: translateY(-4px);
    box-shadow: 3px 3px 0 #000, 0 4px 12px rgba(0, 0, 0, 0.5);
  }

  .ppc-card-mini--keep {
    border-color: #3498db;
    background: linear-gradient(135deg, #2d4a5e 0%, #1a2f3d 100%);
  }

  .ppc-card-mini--discard {
    border-color: #e74c3c;
    background: linear-gradient(135deg, #5e2d2d 0%, #3d1a1a 100%);
  }

  .ppc-card-mini--evolution {
    border-color: #9b59b6;
    background: linear-gradient(135deg, #4a2d5e 0%, #2f1a3d 100%);
  }

  .ppc-card-mini-cost {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.9);
    color: #feca57;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 9px;
    font-family: 'Bangers', cursive;
    border: 1px solid #000;
    line-height: 1;
  }

  .ppc-card-mini-name {
    margin-top: auto;
    font-size: 8px;
    color: #fff;
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
  }

  /* Expanded state (list view) */
  .cmp-player-profile-card[data-expanded="true"] .ppc-owned-cards {
    display: block !important;
  }

  .cmp-player-profile-card:not([data-expanded="true"]) .ppc-owned-cards {
    display: none !important;
  }

  /* In list view, hide owned cards by default unless expanded */
  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card .ppc-owned-cards {
    display: none;
  }

  .cmp-monsters-panel:not(.is-stacked):not(.is-tiled) .cmp-player-profile-card[data-expanded="true"] .ppc-owned-cards {
    display: block;
  }

  /* Stacked view with perspective and rotation transforms */
  .cmp-monsters-panel.is-stacked .mp-player-cards {
    perspective: 1400px;
    perspective-origin: 50% 30%;
  }

  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card {
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94), margin 0.35s ease;
  }

  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card.is-active {
    position: relative;
    z-index: 3100;
    transform: none;
    margin-top: 0;
  }

  /* Base style for non-active stacked cards */
  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:not(.is-active) {
    position: relative;
    z-index: 3000;
    transform: perspective(800px) rotateX(1deg) rotateY(-0.5deg) rotateZ(0.25deg);
    margin-bottom: 0;
  }

  /* Overlap stack: pull subsequent cards upward */
  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:not(.is-active) + .cmp-player-profile-card:not(.is-active) {
    margin-top: -90px;
  }

  /* Individual variance for each card position */
  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:nth-child(1):not(.is-active) {
    transform: perspective(800px) rotateX(0.8deg) rotateY(-0.3deg) rotateZ(-2.2deg);
  }

  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:nth-child(2):not(.is-active) {
    transform: perspective(800px) rotateX(1.2deg) rotateY(0.4deg) rotateZ(2.6deg);
    margin-left: -6px;
  }

  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:nth-child(3):not(.is-active) {
    transform: perspective(800px) rotateX(0.9deg) rotateY(-0.7deg) rotateZ(-2.1deg);
    margin-left: 6px;
  }

  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:nth-child(4):not(.is-active) {
    transform: perspective(800px) rotateX(1.1deg) rotateY(0.2deg) rotateZ(2.4deg);
    margin-left: -5px;
  }

  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:nth-child(5):not(.is-active) {
    transform: perspective(800px) rotateX(0.7deg) rotateY(-0.4deg) rotateZ(-2deg);
    margin-left: 5px;
  }

  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:nth-child(6):not(.is-active) {
    transform: perspective(800px) rotateX(1.3deg) rotateY(0.6deg) rotateZ(2.3deg);
    margin-left: -4px;
  }

  /* Hover effects for stacked cards */
  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:not(.is-active) {
    transform-origin: bottom center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, margin-bottom 0.3s ease, z-index 0s 0.3s;
  }

  .cmp-monsters-panel.is-stacked .mp-player-cards .cmp-player-profile-card:not(.is-active):hover {
    transform: perspective(1000px) rotateX(-10deg) rotateY(0deg) rotateZ(0deg) translateY(-24px) scale(1.05);
    box-shadow: 8px 10px 0 #000, 0 0 0 2px #222 inset, 0 14px 28px rgba(0, 0, 0, 0.65);
    z-index: 3050;
    margin-bottom: 28px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, margin-bottom 0.2s ease, z-index 0s 0s;
  }

  /* Hover effects for non-stacked (list) cards */
  .cmp-monsters-panel:not(.is-stacked) .mp-player-cards .cmp-player-profile-card:not(.is-active) {
    transition: transform 0.2s ease, box-shadow 0.2s ease, z-index 0s 0.2s;
  }

  .cmp-monsters-panel:not(.is-stacked) .mp-player-cards .cmp-player-profile-card:not(.is-active):hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 6px 6px 0 #000, 0 0 0 2px #222 inset, 0 8px 18px rgba(0, 0, 0, 0.45);
    z-index: 3050;
    transition: transform 0.2s ease, box-shadow 0.2s ease, z-index 0s 0s;
  }

  /* Avatar hover effect */
  .cmp-player-profile-card .ppc-avatar:hover {
    transform: scale(1.05);
    box-shadow: 3px 3px 0 #000, 0 0 0 2px #ffd400;
  }

  /* Stats hover effects - scale only, no color */
  .cmp-player-profile-card .ppc-stat[data-cards]:hover {
    transform: scale(1.05);
  }

  .cmp-player-profile-card .ppc-stat[data-cards][data-cards-count="0"]:hover {
    transform: none;
  }

  .cmp-player-profile-card .ppc-stat[data-energy]:hover {
    transform: scale(1.05);
  }

  .cmp-player-profile-card .ppc-stat[data-vp]:hover {
    transform: scale(1.05);
  }


  /* Thicker health bar with color-coded fills */
  .ppc-health-bar {
    position: relative;
    background: #222;
    border: 3px solid #000;
    height: 24px; /* Increased from 20px to 24px for thicker bar */
    overflow: visible; /* Changed from hidden to allow heart icon to show */
  }

  .ppc-health-bar .fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, #3ad65c, #129b37); /* Green for 8-10 HP */
    transition: width 0.35s ease, background 0.35s ease;
  }

  /* Yellow: 6-7 HP */
  .ppc-health-bar[data-health="7"] .fill,
  .ppc-health-bar[data-health="6"] .fill {
    background: linear-gradient(90deg, #f7d740, #d4a800);
  }

  /* Orange: 4-5 HP */
  .ppc-health-bar[data-health="5"] .fill,
  .ppc-health-bar[data-health="4"] .fill {
    background: linear-gradient(90deg, #ff9b40, #e07500);
  }

  /* Red: 1-3 HP */
  .ppc-health-bar[data-health="3"] .fill,
  .ppc-health-bar[data-health="2"] .fill,
  .ppc-health-bar[data-health="1"] .fill,
  .ppc-health-bar[data-low="true"] .fill {
    background: linear-gradient(90deg, #ff4d3d, #b30000);
  }
}

/* =============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================= */

/* Small mobile devices */
@media (max-width: 380px) {
  .ppc-mobile {
    width: 100px;
    height: 72px;
  }

  .ppc-mobile-profile {
    height: 40px;
  }

  .ppc-stat-icon {
    font-size: 10px;
  }

  .ppc-stat-value {
    font-size: 10px;
  }

  .ppc-mobile-name {
    font-size: 11px;
  }
}

/* Large tablet (between mobile and desktop) */
@media (min-width: 769px) and (max-width: 1024px) {
  /* These devices use mobile mode but might need tweaks */
  .ppc-mobile {
    width: 120px;
    height: 85px;
  }
}

/* Desktop size adjustments for smaller screens */
@media (min-width: 1025px) and (max-width: 1366px) {
  .ppc-header {
    gap: 8px;
  }

  .ppc-avatar {
    width: 50px;
    height: 50px;
  }

  .ppc-name {
    font-size: 16px;
  }

  .ppc-stats {
    gap: 6px;
  }

  .ppc-stat .value {
    font-size: 18px;
  }
}

/* =============================================================================
   VISUAL EFFECT ANIMATIONS
   ============================================================================= */

/* Attack pulse animation */
.cmp-player-profile-card.attack-pulse {
  animation: upcPulse 2s ease;
}

@keyframes upcPulse {
  0%, 100% {
    box-shadow: 4px 4px 0 #000, 0 0 0 2px #222 inset;
  }
  50% {
    box-shadow: 0 0 0 3px #ffd400, 0 0 12px 4px #ffdb4d;
  }
}

/* VP gain animation */
.cmp-player-profile-card[data-vp-gain="true"] .ppc-stat[data-vp] {
  animation: statGain 0.6s ease;
}

/* Energy gain animation */
.cmp-player-profile-card[data-energy-gain="true"] .ppc-stat[data-energy] {
  animation: statGain 0.6s ease;
}

/* Health gain animation */
.cmp-player-profile-card[data-health-gain="true"] .ppc-health-block {
  animation: healthGain 0.6s ease;
}

@keyframes statGain {
  0%, 100% {
    transform: scale(1);
    box-shadow: 2px 2px 0 #000;
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 3px #4ecdc4, 0 0 12px 2px rgba(78, 205, 196, 0.6);
  }
}

@keyframes healthGain {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 3px #3ad65c, 0 0 12px 2px rgba(58, 214, 92, 0.6);
  }
}

/* Tokyo entry flourish */
.cmp-player-profile-card[data-entered-tokyo="true"] {
  animation: tokyoEntry 1.2s ease;
}

@keyframes tokyoEntry {
  0% {
    transform: translateY(0) scale(1);
  }
  30% {
    transform: translateY(-10px) scale(1.05);
  }
  60% {
    transform: translateY(5px) scale(0.98);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

/* =============================================================================
   TOMBSTONE TRANSFORMATION (Death Animation)
   ============================================================================= */

.cmp-player-profile-card.is-tombstone {
  animation: transformToTombstone 1.5s ease-out forwards;
  pointer-events: none;
  background: linear-gradient(135deg, #555 0%, #333 100%) !important;
  transition: all 2.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes transformToTombstone {
  0% {
    filter: grayscale(0) brightness(1);
    transform: scale(1);
  }
  50% {
    filter: grayscale(0.5) brightness(0.8);
    transform: scale(0.95);
  }
  100% {
    filter: grayscale(1) brightness(0.6);
    transform: scale(1);
  }
}

/* Tombstone top becomes dome-shaped */
.cmp-player-profile-card.is-tombstone .ppc-header {
  position: relative;
  border-radius: 80px 80px 0 0 / 60px 60px 0 0;
  background: transparent;
  padding-top: 25px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

/* Hide original meta content */
.cmp-player-profile-card.is-tombstone .ppc-meta {
  display: none;
}

/* RIP text in dome - positioned at top */
.cmp-player-profile-card.is-tombstone .ppc-header::before {
  content: 'R.I.P.';
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 36px;
  font-weight: bold;
  color: #ddd;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  letter-spacing: 4px;
  font-family: 'Bangers', cursive;
  z-index: 5;
}

/* Center the avatar in the dome area */
.cmp-player-profile-card.is-tombstone .ppc-avatar {
  position: relative;
  margin: 75px auto 8px;
  filter: grayscale(1) brightness(0.7);
  border-color: #555;
  cursor: default;
}

.cmp-player-profile-card.is-tombstone .ppc-avatar:hover {
  transform: none;
  box-shadow: 2px 2px 0 #000;
}

/* Hide stats, health, and cards in tombstone mode */
.cmp-player-profile-card.is-tombstone .ppc-stats,
.cmp-player-profile-card.is-tombstone .ppc-health-block,
.cmp-player-profile-card.is-tombstone .ppc-owned-cards {
  display: none;
}

/* Tombstone epitaph (quote text) - positioned below avatar */
.ppc-tombstone-epitaph {
  position: relative;
  margin: 12px auto 0;
  text-align: center;
  z-index: 10;
  pointer-events: none;
  width: 85%;
  animation: epitaphFadeIn 1.2s ease-out 0.5s forwards;
  opacity: 0;
}

.ppc-tombstone-name {
  display: block;
  color: #bbb;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.ppc-tombstone-quote {
  display: block;
  color: #999;
  font-size: 9px;
  font-style: italic;
  line-height: 1.3;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

@keyframes epitaphFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    transform: translate(-50%, -50%);
  }
}

/* ==========================================
   Tokyo Slot Positioning
   ========================================== */

/* Unified cards in Tokyo city/bay slots */
.cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot],
.cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot] {
  position: relative;
  margin: 0 auto;
}

/* Scale cards down when in Tokyo slots */
.cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot="city"],
.cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot="bay"] {
  transform: scale(.95);
}

/* Active player in Tokyo - match scaling */
.arena-active-player-dock .cmp-player-profile-card[data-in-tokyo-slot][data-active-player="true"] {
  transform: scale(.95);
}

/* MOBILE: Tokyo slots - Desktop-like layout optimized for mobile slot space */
@media (max-width: 1024px) {
  /* When DESKTOP-style cards are in Tokyo slots on mobile, create a layout similar to desktop */
  /* These are NOT .ppc-mobile class cards - they're regular desktop cards moved to arena */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile),
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile),
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) {
    width: 130% !important;
    height: 130% !important;
    min-height: 0 !important;
    max-height: none !important;
    max-width: none !important;
    margin: 0 !important;
    /* Use solid monster theme color as background */
    background: var(--ppc-accent, #ffcc00) !important;
    border: 3px solid #000 !important;
    border-radius: 8px !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.7), 0 2px 4px rgba(0,0,0,0.5) !important;
    padding: 10px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
    box-sizing: border-box !important;
  }
  
  /* Hide elements we don't need */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-expand-toggle,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-expand-toggle,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-expand-toggle,
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-owned-cards,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-owned-cards,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-owned-cards,
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .scenario-indicator,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .scenario-indicator,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .scenario-indicator,
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-status-line,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-status-line,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-status-line {
    display: none !important;
  }
  
  /* Header - contains name at top */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-header,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-header,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    gap: 4px !important;
    order: 1 !important;
  }
  
  /* Meta section */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-meta,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-meta,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-meta {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
  }
  
  /* Player name - at the very top, large and centered */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-name,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-name,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-name {
    font-family: 'Bangers', cursive !important;
    font-size: clamp(20px, 6vw, 36px) !important;
    color: #fff !important;
    text-align: center !important;
    text-shadow: 
      -2px -2px 0 #000,
      2px -2px 0 #000,
      -2px 2px 0 #000,
      2px 2px 0 #000,
      -1px -1px 0 #000,
      1px -1px 0 #000,
      -1px 1px 0 #000,
      1px 1px 0 #000,
      2px 2px 4px rgba(0,0,0,0.8) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    letter-spacing: 1px !important;
    line-height: 1 !important;
    order: 0 !important;
  }
  
  /* Avatar - large circular image */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-avatar,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-avatar,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-avatar {
    display: block !important;
    width: 105px !important;
    height: 105px !important;
    min-width: 105px !important;
    min-height: 105px !important;
    margin: 0 auto !important;
    border: 3px solid #000 !important;
    border-radius: 50% !important;
    background-color: #fff !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    overflow: hidden !important;
    order: 2 !important;
  }
  
  /* Stats section - horizontal row of 3 tiles */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stats,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stats,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stats {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
    justify-content: center !important;
    align-items: stretch !important;
    width: 100% !important;
    order: 3 !important;
  }
  
  /* Individual stat tiles - vertical layout with label on top */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: #fafafa !important;
    border: 2px solid #000 !important;
    border-radius: 4px !important;
    padding: 6px 8px !important;
    box-shadow: 1px 1px 0 #000 !important;
    cursor: pointer !important;
    transition: transform 0.15s ease !important;
    gap: 2px !important;
    flex: 1 !important;
    min-height: 0 !important;
  }
  
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat:hover,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat:hover,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat:hover {
    transform: scale(1.03) !important;
  }
  
  /* Stat labels - top */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .label,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .label,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .label {
    display: block !important;
    font-family: 'Bangers', cursive !important;
    font-size: 10px !important;
    color: #666 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin: 0 !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
  
  /* Stat values - below label, larger with yellow color and black outline */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .value,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .value,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .value {
    display: block !important;
    font-family: 'Bangers', cursive !important;
    font-size: 28px !important;
    color: #ffcc00 !important;
    line-height: 1 !important;
    margin: 0 !important;
    text-align: center !important;
    text-shadow: 
      -2px -2px 0 #000,
      2px -2px 0 #000,
      -2px 2px 0 #000,
      2px 2px 0 #000,
      -1px -1px 0 #000,
      1px -1px 0 #000,
      -1px 1px 0 #000,
      1px 1px 0 #000 !important;
  }
  
  /* Keep decorative elements (energy bolt, vp coin) */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .energy-bolt,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .energy-bolt,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .energy-bolt {
    position: absolute !important;
    top: 50% !important;
    right: 4px !important;
    transform: translateY(-50%) !important;
    font-size: 16px !important;
    opacity: 0.15 !important;
    pointer-events: none !important;
  }
  
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .vp-coin,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .vp-coin,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-stat .vp-coin {
    position: absolute !important;
    top: 50% !important;
    right: 4px !important;
    transform: translateY(-50%) !important;
    font-size: 16px !important;
    opacity: 0.15 !important;
    pointer-events: none !important;
  }
  
  /* Health block - bottom of card, full width */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-block,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-block,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-block {
    display: block !important;
    width: 100% !important;
    background: #fff !important;
    border: 3px solid #000 !important;
    box-shadow: 2px 2px 0 #000 !important;
    padding: 8px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    order: 4 !important;
  }
  
  /* Health label */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-label,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-label,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-label {
    display: block !important;
    font-family: 'Bangers', cursive !important;
    font-size: 14px !important;
    color: #000 !important;
    margin: 0 0 5px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    text-shadow: none !important;
  }
  
  /* Health bar container */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar {
    display: block !important;
    position: relative !important;
    background: #222 !important;
    border: 2px solid #000 !important;
    height: 18px !important;
    overflow: hidden !important;
    margin: 0 !important;
  }
  
  /* Health fill - green when healthy, yellow when medium, red when low */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar .fill,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar .fill,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar .fill {
    display: block !important;
    height: 100% !important;
    background: #4caf50 !important;
    transition: width 0.3s ease, background-color 0.3s ease !important;
  }
  
  /* Health bar color changes based on data-low attribute */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar[data-low="true"] .fill,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar[data-low="true"] .fill,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar[data-low="true"] .fill {
    background: #f44336 !important;
  }
  
  /* Medium health (4-6 hearts) - yellow */
  .cmp-arena .city-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar[data-medium="true"] .fill,
  .cmp-arena .bay-slot .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar[data-medium="true"] .fill,
  .cmp-arena [data-arena-section] .cmp-player-profile-card[data-in-tokyo-slot]:not(.ppc-mobile) .ppc-health-bar[data-medium="true"] .fill {
    background: #ffc107 !important;
  }
}


/* =============================================================================
   MAX HEALTH INCREASE ANIMATION (Even Bigger Power Card)
   ============================================================================= */

/* Heart icon centered on screen */
.max-health-heart-icon {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 48px; /* Large and visible */
  z-index: 99999; /* Highest possible z-index */
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  filter: drop-shadow(0 0 8px rgba(255, 0, 0, 0.8));
  text-shadow: 0 0 12px rgba(255, 0, 0, 0.8);
  transition: none;
}

.max-health-heart-icon.visible {
  opacity: 1;
  visibility: visible;
}

/* Text overlay for max health increase */
.max-health-text-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 48px;
  font-weight: 900;
  color: #fff;
  text-shadow: 
    0 0 10px rgba(58, 214, 92, 1),
    0 0 20px rgba(58, 214, 92, 0.8),
    0 0 30px rgba(58, 214, 92, 0.6),
    3px 3px 6px rgba(0, 0, 0, 0.9);
  z-index: 99998; /* Just below heart */
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in;
  white-space: nowrap;
  font-family: 'Bangers', cursive;
  letter-spacing: 3px;
}

.max-health-text-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.max-health-text-overlay.shrinking {
  animation: text-shrink-fade 0.5s ease-out forwards;
}

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

/* Growth animation - heart grows larger and larger */
@keyframes heart-grow {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 1;
  }
  60% {
    transform: translate(-50%, -50%) scale(5);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(8);
    opacity: 1;
    filter: drop-shadow(0 0 30px rgba(255, 0, 0, 1));
    text-shadow: 0 0 25px rgba(255, 0, 0, 1);
  }
}

.max-health-heart-icon.growing {
  animation: heart-grow 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Explosion animation - heart bursts into particles */
@keyframes heart-explode {
  0% {
    transform: translate(-50%, -50%) scale(5);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -50%) scale(6);
    opacity: 0.9;
    filter: drop-shadow(0 0 40px rgba(255, 255, 255, 1)) 
            drop-shadow(0 0 30px rgba(58, 214, 92, 1));
    text-shadow: 0 0 30px rgba(255, 255, 255, 1);
  }
  100% {
    transform: translate(-50%, -50%) scale(0.1);
    opacity: 0;
    filter: drop-shadow(0 0 60px rgba(58, 214, 92, 0.5));
  }
}

.max-health-heart-icon.exploding {
  animation: heart-explode 0.4s ease-out forwards;
}

/* Player card shake and scale animation (after heart explodes) */
/* Card grows LARGER than its container (Tokyo slot) */
@keyframes card-shake-scale {
  0% {
    transform: translateX(0) scale(1);
  }
  10% {
    transform: translateX(-8px) scale(1.05);
  }
  20% {
    transform: translateX(8px) scale(1.1);
  }
  30% {
    transform: translateX(-8px) scale(1.15);
  }
  40% {
    transform: translateX(8px) scale(1.2);
  }
  50% {
    transform: translateX(-6px) scale(1.25); /* Max scale - larger than Tokyo container */
  }
  60% {
    transform: translateX(6px) scale(1.2);
  }
  70% {
    transform: translateX(-4px) scale(1.15);
  }
  80% {
    transform: translateX(4px) scale(1.1);
  }
  90% {
    transform: translateX(-2px) scale(1.05);
  }
  100% {
    transform: translateX(0) scale(1.25); /* Stay large */
  }
}

.cmp-player-profile-card.card-max-health-boost,
.ppc-mobile.card-max-health-boost {
  animation: card-shake-scale 1.0s ease-out forwards;
  filter: brightness(1.3) drop-shadow(0 0 25px rgba(58, 214, 92, 0.8));
  z-index: 10000; /* Ensure card is above container */
  position: relative; /* Allow z-index to work */
}

/* Card settling back to normal size */
@keyframes card-settle {
  0% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

.cmp-player-profile-card.card-max-health-settling,
.ppc-mobile.card-max-health-settling {
  animation: card-settle 0.3s ease-out forwards;
}

/* Dim the card while notification is showing to improve text visibility */
.cmp-player-profile-card.card-dimmed-for-notification,
.ppc-mobile.card-dimmed-for-notification {
  filter: brightness(0.5);
  transition: filter 0.2s ease-out;
}

/* Pulse animation when max health increases (starts after card settles) */
@keyframes max-health-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(58, 214, 92, 0.8);
    border-color: #000;
  }
  50% {
    box-shadow: 0 0 30px 15px rgba(58, 214, 92, 0.6);
    border-color: #3ad65c;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(58, 214, 92, 0);
    border-color: #000;
  }
}

/* Apply animation when max health increases */
.ppc-health-bar.max-health-increased {
  animation: max-health-pulse 0.8s ease-out;
}

/* Emphasize the fill bar during animation */
.ppc-health-bar.max-health-increased .fill {
  box-shadow: 
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(58, 214, 92, 0.8);
  transition: width 0.5s ease, box-shadow 0.5s ease;
}

/* Max health increase notification (appears on health bar) */
.max-health-notification {
  position: absolute;
  top: -3px; /* Moved down more to be more centered on the health bar */
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 900;
  color: white; /* White text with black outline for better visibility */
  text-shadow: 
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000,
    0 0 8px rgba(255, 255, 255, 0.8),
    0 0 12px rgba(255, 255, 255, 0.6);
  font-family: 'Bangers', cursive;
  letter-spacing: 1px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  animation: max-health-notify 1.5s ease-out forwards;
}

@keyframes max-health-notify {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1.2);
  }
  80% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px) scale(0.8);
  }
}

/* Freeze Time clock pop animation (when ①①① is rolled) */
@keyframes clock-pop {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 1;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
}

/* =============================================================================
   MINIFIGURE MODE (Desktop only)
   When in Tokyo and minifigure mode is enabled, show only the monster image
   ============================================================================= */

@media (min-width: 1025px) {
  /* Minifigure mode: Show only the monster avatar when in Tokyo */
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] {
    /* Keep card structure for flip animation */
    width: auto;
    max-width: none;
  }
  
  /* Hide the front card content except header */
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
  }
  
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-meta,
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-stats,
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-health-block,
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-owned-cards,
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-expand-toggle {
    display: none !important;
  }
  
  /* Show only the header with enlarged avatar */
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-header {
    margin: 0;
  }
  
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-avatar {
    width: 200px;
    height: 200px;
    margin: 0;
    border: 5px solid #000;
    border-radius: 0;
    box-shadow: 
      0 8px 16px rgba(0, 0, 0, 0.5),
      0 0 0 3px rgba(255, 212, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
  
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-avatar:hover {
    transform: scale(1.05);
    box-shadow: 
      0 12px 24px rgba(0, 0, 0, 0.6),
      0 0 0 4px rgba(255, 212, 0, 0.5);
  }
  
  /* Add player name overlay on hover */
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-avatar::before {
    content: attr(data-player-name);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffd400;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: 'Bangers', cursive;
    font-size: 18px;
    letter-spacing: 1px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
  }
  
  .cmp-player-profile-card.ppc-minifigure-mode[data-in-tokyo-slot] .ppc-card-front .ppc-avatar:hover::before {
    opacity: 1;
  }
}


