/* =============================================================================
   RAKUN DOJO - ENHANCED COMPONENT STYLES
   Clean, optimized, and fully functional component styling
   ============================================================================= */

/* =============================================================================
   GAME INTERFACE COMPONENTS
   ============================================================================= */

.game-section {
  padding: var(--space-6);
  border-top: 1px solid var(--border-primary);
}

/* =============================================================================
   RAKUN CARD COMPONENTS
   ============================================================================= */

.rakun-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.rakun-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Ultra-compact rakun header */
.rakun-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-bottom: var(--space-4);
}

.rakun-name-section {
  flex: 1;
  text-align: left;
}

.rakun-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.rakun-name:hover {
  color: var(--color-accent-yellow);
}

.rakun-stats-compact {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.75rem;
}

/* Ultra-compact level display - NARROWER THAN XP */
.rakun-level-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-md);
  padding: 2px 6px;
  min-width: 60px;  /* NARROWER THAN XP SECTION */
  transition: all 0.3s ease;
}

.rakun-level-compact:hover {
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.level-info-compact {
  display: flex;
  align-items: center;
  gap: 2px;
}

.level-label-compact {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.level-value-compact {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-accent-blue);
}

/* Ultra-compact XP display - MATCHED SIZE TO LEVEL */
.xp-section-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;  /* MATCHED TO LEVEL SECTION */
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 2px 6px;
  transition: all 0.3s ease;
}

.xp-section-compact:hover {
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
  transform: translateY(-1px);
}

.xp-info-compact {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.6rem;
  font-weight: 600;
}

.xp-icon-compact {
  font-size: 0.7rem;
  color: var(--color-accent-yellow);
}

.xp-current {
  color: var(--color-accent-yellow);
}

.xp-separator {
  color: rgba(255, 255, 255, 0.5);
}

.xp-needed {
  color: rgba(255, 255, 255, 0.7);
}

.xp-bar-compact {
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.xp-fill-compact {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent-yellow), #f59e0b);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Rakun name editing styles */
.rakun-name-input {
  outline: none;
  background: rgba(0, 0, 0, 0.7) !important;
  border: 2px solid #fbbf24 !important;
  border-radius: 6px !important;
  color: white !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  padding: 2px 8px !important;
  width: 150px !important;
  text-align: left !important;
}

.rakun-name-input:focus {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important;
}

/* =============================================================================
   RAKUN DISPLAY AREA
   ============================================================================= */

.rakun-display {
  position: relative;
  background: linear-gradient(135deg, 
    var(--bg-secondary) 0%, 
    var(--bg-primary) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  margin: var(--space-4) 0;
  min-height: 200px;
  height: 250px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border: 2px solid var(--border-primary);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rakun-display::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  animation: rotateGlow 20s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.rakun-avatar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rakun-sprite {
  font-size: 2.5rem !important;
  transition: all var(--transition-base);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
  transform-origin: center bottom;
  display: inline-block;
  z-index: 3;
  position: relative;
  animation: idleBreathe 4s ease-in-out infinite;
}

.rakun-placeholder {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  text-align: center;
  padding: var(--space-4);
  opacity: 0.7;
}

/* =============================================================================
   STATUS INDICATORS
   ============================================================================= */

.status-indicators {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 4;
}

.status-indicator {
  background: rgba(0, 0, 0, 0.8);
  padding: var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-lg);
  animation: pulse 2s ease-in-out infinite;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-indicator.hunger { animation-delay: 0s; }
.status-indicator.happiness { animation-delay: 0.2s; }
.status-indicator.energy { animation-delay: 0.4s; }
.status-indicator.sickness { animation-delay: 0.6s; }
.status-indicator.cleanliness { animation-delay: 0.8s; }

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

/* =============================================================================
   STATISTICS GRID
   ============================================================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.stat-item {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 45px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.stat-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left 0.6s ease;
}

.stat-item:hover {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 20px rgba(59, 130, 246, 0.2);
}

.stat-item:hover::before {
  left: 100%;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.stat-icon {
  font-size: 16px;
  filter: drop-shadow(0 0 4px currentColor);
}

.stat-name {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.stat-value {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  font-family: 'Courier New', monospace;
}

.stat-bar {
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-fill {
  height: 100%;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

/* Animated shine effect */
.stat-fill::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 30%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0.4) 70%, transparent 100%);
  animation: stat-shine 3s ease-in-out infinite;
}

@keyframes stat-shine {
  0% { left: -100%; }
  50% { left: -100%; }
  100% { left: 100%; }
}

/* Enhanced color system with gradients */
.stat-item.happiness .stat-fill { 
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 50%, #fcd34d 100%);
}

.stat-item.fullness .stat-fill { 
  background: linear-gradient(90deg, #10b981 0%, #34d399 50%, #6ee7b7 100%);
}

.stat-item.strength .stat-fill { 
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 50%, #f87171 100%);
}

.stat-item.energy .stat-fill { 
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 50%, #93c5fd 100%);
}

.stat-item.cleanliness .stat-fill { 
  background: linear-gradient(90deg, #06b6d4 0%, #22d3ee 50%, #67e8f9 100%);
}

.stat-item.health .stat-fill { 
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 50%, #f87171 100%);
}

/* Low stat warning effects */
.stat-item[data-value="low"] .stat-fill::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 6px;
  opacity: 1;
  animation: stat-warning 2s ease-in-out infinite;
  background: inherit;
  box-shadow: 0 0 10px currentColor;
}

@keyframes stat-warning {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* Critical stat effects */
.stat-item[data-value="critical"] {
  border-color: rgba(220, 38, 38, 0.6);
  animation: stat-critical 1.5s ease-in-out infinite;
}

@keyframes stat-critical {
  0%, 100% { box-shadow: 0 0 10px rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 20px rgba(220, 38, 38, 0.6); }
}

/* =============================================================================
   ACTION BUTTONS GRID
   ============================================================================= */

.actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.action-btn {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  color: var(--text-primary);
  min-height: 40px;
  justify-content: center;
  font-family: var(--font-family-base);
  font-size: var(--text-sm);
}

.action-btn:hover {
  border-color: var(--color-accent-blue);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, var(--color-accent-blue) 0%, var(--color-accent-purple) 100%);
}

.action-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.action-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.action-icon {
  font-size: var(--text-lg);
  margin-bottom: 2px;
}

.action-text {
  font-size: 10px;
  text-align: center;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

/* Action button success animation */
.action-success {
  animation: actionSuccess 0.6s ease-out;
}

@keyframes actionSuccess {
  0% {
    transform: scale(1);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  }
  50% {
    transform: scale(1.1);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(16, 185, 129, 0.1) 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
  }
  100% {
    transform: scale(1);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  }
}

/* =============================================================================
   MODAL COMPONENTS
   ============================================================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-xl);
}

.modal-overlay.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-primary);
  background: var(--bg-secondary);
}

.modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-family-display);
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--text-2xl);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transform: scale(1.1);
}

.modal-body {
  padding: var(--space-6);
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--border-primary);
  background: var(--bg-secondary);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* =============================================================================
   LEVEL UP OVERLAY
   ============================================================================= */

.level-up-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

.level-up-overlay.show {
  opacity: 1;
  visibility: visible;
}

.level-up-content {
  background: var(--bg-primary);
  border: 2px solid var(--color-accent-gold);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  animation: levelUpBounce 0.6s ease-out;
  box-shadow: 0 0 50px rgba(245, 158, 11, 0.3);
}

.level-up-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  animation: levelUpSpin 2s ease-out;
}

.level-up-content h2 {
  color: var(--color-accent-gold);
  margin: 0 0 var(--space-4) 0;
  font-size: var(--text-3xl);
  font-family: var(--font-family-display);
}

.new-level {
  font-size: var(--text-2xl);
  color: var(--color-accent-blue);
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.level-up-sparkles {
  font-size: var(--text-2xl);
  animation: levelUpSparkle 2s ease-out infinite;
}

/* =============================================================================
   MESSAGE COMPONENTS
   ============================================================================= */

.message-area {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  pointer-events: none;
  max-width: 350px;
}

.message {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  transform: translateX(100%);
  opacity: 0;
  animation: messageSlideIn 0.3s ease-out forwards;
}

@keyframes messageSlideIn {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.message.fade-out {
  animation: messageSlideOut 0.3s ease-in forwards;
}

@keyframes messageSlideOut {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* =============================================================================
   XP GAIN AND LEVEL UP ANIMATIONS (MISSING FROM PREVIOUS CHATS)
   ============================================================================= */

/* Floating XP gain text animation */
.xp-gain-float {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  color: #fbbf24;
  font-weight: bold;
  font-size: 14px;
  pointer-events: none;
  z-index: 1000;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  animation: xpFloatUp 2s ease-out forwards;
}

@keyframes xpFloatUp {
  0% { 
    opacity: 0; 
    transform: translateX(-50%) translateY(0px) scale(0.5); 
  }
  20% { 
    opacity: 1; 
    transform: translateX(-50%) translateY(-20px) scale(1.2); 
  }
  100% { 
    opacity: 0; 
    transform: translateX(-50%) translateY(-40px) scale(0.8); 
  }
}

/* XP bar pulse effect when gaining XP */
.xp-bar-pulse::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  opacity: 0;
  animation: xpPulse 3s ease-in-out infinite;
}

@keyframes xpPulse {
  0%, 100% {
    opacity: 0;
    transform: scaleY(1);
  }
  50% {
    opacity: 0.5;
    transform: scaleY(1.5);
  }
}

/* Enhanced level up overlay with all animations */
.level-up-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
  animation: overlayFadeIn 0.5s ease-out;
}

.level-up-overlay.show {
  opacity: 1;
  visibility: visible;
}

.level-up-overlay.hide {
  animation: overlayFadeOut 0.5s ease-in;
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(10px);
  }
}

@keyframes overlayFadeOut {
  from {
    opacity: 1;
    backdrop-filter: blur(10px);
  }
  to {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
}

.level-up-content {
  background: var(--bg-primary);
  border: 2px solid var(--color-accent-gold);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  animation: levelUpBounce 0.6s ease-out;
  box-shadow: 0 0 50px rgba(245, 158, 11, 0.3);
  position: relative;
  overflow: hidden;
}

.level-up-content::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
  animation: rotateGlow 3s linear infinite;
  pointer-events: none;
}

@keyframes levelUpBounce {
  0% {
    transform: scale(0.3) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.1) rotate(-10deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.level-up-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  animation: levelUpSpin 2s ease-out;
  position: relative;
  z-index: 2;
}

@keyframes levelUpSpin {
  0% {
    transform: rotate(0deg) scale(0.5);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.level-up-content h2 {
  color: var(--color-accent-gold);
  margin: 0 0 var(--space-4) 0;
  font-size: var(--text-3xl);
  font-family: var(--font-family-display);
  position: relative;
  z-index: 2;
}

.new-level {
  font-size: var(--text-2xl);
  color: var(--color-accent-blue);
  font-weight: 700;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 2;
}

.level-up-sparkles {
  font-size: var(--text-2xl);
  animation: levelUpSparkle 2s ease-out infinite;
  position: relative;
  z-index: 2;
}

@keyframes levelUpSparkle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.level-up-text {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
  background: linear-gradient(45deg, #FFD700, #FFA500, #FFD700);
  background-size: 200% 200%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: levelUpGradient 2s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

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

/* =============================================================================
   RESPONSIVE DESIGN - ENHANCED
   ============================================================================= */

@media (max-width: 768px) {
  .rakun-name {
    font-size: 1rem;
  }
  
  /* NARROWER LEVEL SECTION AT TABLET LEVEL */
  .rakun-level-compact {
    min-width: 55px;  /* Narrower than XP section */
    padding: 1px 4px;
  }
  
  .level-value-compact {
    font-size: 0.7rem;
  }
  
  .xp-section-compact {
    min-width: 70px;  /* Wider than level section */
    padding: 1px 4px;
  }
  
  .xp-info-compact {
    font-size: 0.55rem;
  }

  .rakun-sprite {
    font-size: 2rem !important;
  }
  
  .rakun-display {
    height: 200px !important;
    padding: var(--space-4);
  }
  
  .stats-grid {
    gap: var(--space-1);
  }

  .actions-grid {
    gap: var(--space-1);
  }

  .action-btn {
    padding: var(--space-1);
    gap: 2px;
    min-height: 35px;
  }

  .action-icon {
    font-size: var(--text-base);
  }

  .action-text {
    font-size: 9px;
  }

  .stat-item {
    padding: var(--space-1);
    min-height: 40px;
  }

  .stat-icon {
    font-size: 14px;
  }

  .stat-name {
    font-size: 9px;
  }

  .stat-value {
    font-size: 11px;
  }

  .rakun-card {
    padding: var(--space-4);
  }

  .modal-content {
    margin: var(--space-2);
    max-height: 95vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--space-4);
  }

  .message-area {
    left: var(--space-2);
    right: var(--space-2);
    max-width: none;
  }
}

@media (max-width: 480px) {
  .rakun-name {
    font-size: 0.9rem;
  }
  
  /* NARROWER LEVEL SECTION AT MOBILE LEVEL */
  .rakun-level-compact {
    min-width: 50px;  /* Narrower than XP section */
  }
  
  .level-value-compact {
    font-size: 0.65rem;
  }
  
  .xp-section-compact {
    min-width: 60px;  /* Wider than level section */
  }
  
  .xp-info-compact {
    font-size: 0.5rem;
  }

  .rakun-sprite {
    font-size: 1.5rem !important;
  }
  
  .rakun-display {
    height: 150px !important;
    padding: var(--space-2);
  }

  /* FIXED: Prevent header from going vertical - keep level/XP in header bar */
  .rakun-header {
    flex-direction: row !important;  /* Force horizontal always */
    gap: var(--space-2);
    text-align: left;  /* Keep left alignment */
  }

  .rakun-stats-compact {
    justify-content: flex-end;  /* Keep stats on right side */
  }

  .stats-grid {
    gap: 4px;
  }

  .actions-grid {
    gap: 4px;
  }

  .action-btn {
    padding: 4px;
    gap: 1px;
    min-height: 30px;
  }

  .action-icon {
    font-size: var(--text-sm);
  }

  .action-text {
    font-size: 8px;
  }

  .stat-item {
    padding: var(--space-1);
    min-height: 35px;
    gap: 2px;
  }

  .stat-icon {
    font-size: 12px;
  }

  .stat-name {
    font-size: 8px;
  }

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

  .stat-bar {
    height: 4px;
  }

  .status-indicators {
    position: static;
    flex-direction: row;
    justify-content: center;
    margin-top: var(--space-4);
  }

  .status-indicator {
    font-size: var(--text-sm);
    padding: var(--space-1);
  }
}

/* =============================================================================
   RESET GAME CONFIRMATION STYLES
   ============================================================================= */

.reset-confirmation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.reset-confirmation-content {
    background: var(--bg-primary);
    border: 2px solid rgba(239, 68, 68, 0.5);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    max-width: 90vw;
    width: 400px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.reset-warning-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    color: #f59e0b;
}

.reset-confirmation-content h3 {
    color: #ef4444;
    margin-bottom: var(--space-4);
    font-size: var(--text-xl);
}

.reset-confirmation-content ul {
    text-align: left;
    margin: var(--space-4) 0;
    padding-left: var(--space-6);
    color: var(--text-secondary);
}

.reset-confirmation-buttons {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    margin-top: var(--space-6);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 1px solid #dc2626;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-icon {
    margin-right: var(--space-2);
}

.setting-description {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

/* Enhanced Settings Modal Styles */
.settings-modal {
    max-width: 600px;
    max-height: 90vh;
}

.settings-header {
    text-align: center;
}

.settings-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-2);
    margin-bottom: 0;
}

.section-header {
    margin-bottom: var(--space-4);
}

.section-description {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: var(--space-1);
    line-height: 1.4;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.setting-item.enhanced {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.setting-item.enhanced:hover {
    background: var(--bg-secondary);
    border-color: var(--border-secondary);
}

.setting-main {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

.setting-icon {
    font-size: var(--text-lg);
    width: 24px;
    text-align: center;
}

.setting-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.setting-description {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: 1.3;
}

.setting-control {
    flex-shrink: 0;
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-primary);
    transition: var(--transition-base);
    border-radius: 12px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    transition: var(--transition-base);
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--color-accent-blue);
    border-color: var(--color-accent-blue);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: white;
}

/* Danger Zone Styles */
.danger-zone .section-header h4 {
    color: #ef4444;
}

.setting-item.danger-item {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

.setting-item.danger-item:hover {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
}

/* Info Item Styles */
.setting-item.info-item {
    background: var(--bg-secondary);
}

.setting-value {
    font-family: var(--font-family-mono);
    font-size: var(--text-sm);
    color: var(--color-accent-blue);
    font-weight: 600;
}

.contract-address {
    font-family: var(--font-family-mono);
    font-size: var(--text-xs);
}

.network-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.status-indicator {
    font-size: var(--text-sm);
}

.status-indicator.connected {
    color: #10b981;
}

.status-text {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.copy-contract {
    gap: var(--space-1);
}


/* =============================================================================
   OPTIMIZED CHARACTER SELECTION MODAL
   ============================================================================= */

.rakun-type-selection {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(8px);
  padding: var(--space-4);
}

.type-selection-modal {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn 0.3s ease-out;
}

.type-selection-modal h3 {
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  font-size: var(--text-2xl);
  font-family: var(--font-family-display);
}

.type-selection-modal p {
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  line-height: 1.6;
  font-size: var(--text-base);
}

.rakun-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.rakun-type-option {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rakun-type-option:hover {
  border-color: var(--color-accent-blue);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  background: var(--bg-tertiary);
}

.type-preview {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
}

.rakun-type-option:hover .type-preview {
  transform: scale(1.05);
  background: linear-gradient(135deg, var(--color-accent-blue-light), var(--bg-tertiary));
}

.rakun-type-option h4 {
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  font-size: var(--text-lg);
  font-family: var(--font-family-display);
  font-weight: 600;
}

.rakun-type-option p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.4;
  flex-grow: 1;
  margin: 0;
}

/* =============================================================================
   MOBILE OPTIMIZATIONS FOR CHARACTER SELECTION
   ============================================================================= */

@media (max-width: 768px) {
  .type-selection-modal {
    padding: var(--space-6);
    margin: var(--space-2);
    max-height: 95vh;
  }
  
  .type-selection-modal h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-3);
  }
  
  .type-selection-modal p {
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
  }
  
  .rakun-types-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
  }
  
  .rakun-type-option {
    padding: var(--space-4);
    min-height: 240px;
  }
  
  .type-preview {
    height: 100px;
    margin-bottom: var(--space-3);
  }
  
  .rakun-type-option h4 {
    font-size: var(--text-base);
    margin-bottom: var(--space-2);
  }
  
  .rakun-type-option p {
    font-size: var(--text-xs);
  }
}

@media (max-width: 480px) {
  .rakun-type-selection {
    padding: var(--space-2);
  }
  
  .type-selection-modal {
    padding: var(--space-4);
    margin: var(--space-1);
    border-radius: var(--radius-lg);
  }
  
  .type-selection-modal h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
  }
  
  .type-selection-modal p {
    font-size: var(--text-xs);
    margin-bottom: var(--space-3);
  }
  
  .rakun-types-grid {
    gap: var(--space-3);
  }
  
  .rakun-type-option {
    padding: var(--space-3);
    min-height: 200px;
    border-radius: var(--radius-md);
  }
  
  .type-preview {
    height: 80px;
    margin-bottom: var(--space-2);
    border-radius: var(--radius-md);
  }
  
  .rakun-type-option h4 {
    font-size: var(--text-sm);
    margin-bottom: var(--space-1);
  }
  
  .rakun-type-option p {
    font-size: 10px;
    line-height: 1.3;
  }
}

/* =============================================================================
   LANDSCAPE MOBILE OPTIMIZATION
   ============================================================================= */

@media (max-height: 500px) and (orientation: landscape) {
  .type-selection-modal {
    max-height: 98vh;
    padding: var(--space-3);
  }
  
  .rakun-types-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
  }
  
  .rakun-type-option {
    min-height: 160px;
    padding: var(--space-2);
  }
  
  .type-preview {
    height: 60px;
    margin-bottom: var(--space-1);
  }
  
  .rakun-type-option h4 {
    font-size: var(--text-xs);
    margin-bottom: var(--space-1);
  }
  
  .rakun-type-option p {
    font-size: 9px;
  }
}

/* =============================================================================
   CONFETTI ANIMATION
   ============================================================================= */

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti-particle {
  border-radius: 50%;
  pointer-events: none;
}

/* =============================================================================
   ROTATING GLOW EFFECT FOR LEVEL UP
   ============================================================================= */

@keyframes rotateGlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}