:root {
  --arena-max-width: 1024px;
  --arena-ring-height: 512px;
  --arena-card-size: 128px;
  --arena-gap: 16px;
  
  /* TV Remote positioning controls */
  --remote-offset-x: 0px;
  --remote-offset-y: -25px;
  --remote-rotation: 5deg;
  --remote-scale: 3.5;
  
  /* Log Out button controls */
  --logout-vertical-offset: 55px;
  --logout-width: 43px;
  --logout-height: 15px;
  --logout-font-size: 8px;
  
  /* Shop button controls */
  --shop-vertical-offset: -28px;
  --shop-width: 43px;
  --shop-height: 12px;
  --shop-font-size: 8px;
  
  /* Newspaper positioning controls */
  --newspaper-offset-x: -50px;
  --newspaper-offset-y: -80px;
  --newspaper-rotation: -20deg;
  --newspaper-scale: 4.0;
  
  /* Coin container positioning controls */
  --coin-offset-x: -80px;
  --coin-offset-y: -470px;
  --coin-scale: 4.0;
  
  /* Incubator positioning controls */
  --incubator-offset-x: 0px;
  --incubator-offset-y: 0px;
  --incubator-scale: 1.5;
}

.arena-main-container {
  max-width: var(--arena-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--arena-gap);
  box-sizing: border-box;
  position: relative; /* positioning context for newspaper */
}

/* Lower Container - Houses both login and user containers */
.lower-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative; /* for remote positioning */
  z-index: 5;
}

/* Login Container - Parchment styling */
.login-container {
  width: 60%;
  min-height: 200px;
  background: #f5e6d3; /* parchment color */
  background-image: url('/shared/images/parchment-tex.png');
  border-radius: 2px;
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  box-shadow: 
    inset 0 0 30px rgba(101, 67, 33, 0.3), /* inner darkening */
    inset 0 0 60px rgba(101, 67, 33, 0.15), /* broader inner darkening */
    0 4px 15px rgba(0, 0, 0, 0.2); /* subtle outer shadow */
}

/* Add a vignette overlay for extra worn effect */
.login-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 12px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 50%, rgba(101, 67, 33, 0.15) 85%, rgba(101, 67, 33, 0.25) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Ensure content is above the vignette */
.login-container > * {
  position: relative;
  z-index: 2;
}

/* User Container - Leather binding (formerly controls-container) */
.user-container {
  width: 90%;
  min-height: 200px;
  background: #5a3e2b; /* rich brown leather */
  background-image: repeating-linear-gradient(90deg, transparent, transparent 10px, #4b3424 11px);
  border: 12px solid #3e2a1a;
  border-radius: 20px;
  padding: 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 
    inset 0 0 20px #2a1b12,
    0 4px 12px rgba(0, 0, 0, 0.4);
}

.user-container h3 {
  margin-top: 0;
  margin-bottom: 16px;
  text-align: center;
  font-size: 1.4rem;
  color: #2F2F2F;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* TV Remote positioning */
.tv-remote {
  position: absolute;
  right: -80px; /* base position: to the right of the container */
  top: 50%; /* vertically centered */
  width: 60px;
  height: auto;
  z-index: 100; /* above monsters section */
  pointer-events: none;
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.3));
  transform: 
    translateY(-50%) /* center vertically */
    translateX(var(--remote-offset-x)) 
    translateY(var(--remote-offset-y)) 
    rotate(var(--remote-rotation)) 
    scale(var(--remote-scale));
  transform-origin: center center;
}

.tv-remote img {
  width: 100%;
  height: auto;
  display: block;
}

/* Shop button styling */
.shop-button {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: 
    translate(-50%, -50%) /* Center the button horizontally */
    translateY(var(--shop-vertical-offset)); /* Apply vertical offset */
  width: var(--shop-width);
  height: var(--shop-height);
  font-size: var(--shop-font-size);
  background-color: #357B35; /* Dark green */
  color: #123312; /* Dark green text */
  border: 1px solid #459545; /* Lighter green border */
  border-radius: 2px;
  font-weight: bold;
  font-family: 'Oswald', Arial, sans-serif;
  cursor: pointer;
  pointer-events: all; /* Override parent's pointer-events: none */
  transition: all 0.2s ease;
  text-transform: uppercase;
  text-align: center;
  padding-top: 0px;
  padding-bottom: 12px;
  display: none; /* Hidden by default, shown only when logged in */
}

/* Log Out button styling */
.logout-button {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: 
    translate(-50%, -50%) /* Center the button */
    translateY(var(--logout-vertical-offset)); /* Apply vertical offset */
  width: var(--logout-width);
  height: var(--logout-height);
  font-size: var(--logout-font-size);
  background-color: #8B3535; /* Dark red */
  color: #331212; /* Light red text */
  border: 1px solid #A04545; /* Slightly lighter red border */
  border-radius: 2px;
  font-weight: bold;
  font-family: 'Oswald', Arial, sans-serif;
  cursor: pointer;
  pointer-events: all; /* Override parent's pointer-events: none */
  transition: all 0.2s ease;

  text-transform: uppercase;
  text-align: center;
  padding-top: 0px;
  padding-bottom: 12px;
  display: none; /* Hidden by default, shown only when logged in */
}

.shop-button:hover {
  background-color: #459545; /* Lighter green on hover */
  color: #B8FFB8; /* Light green text on hover */
  transform: 
    translate(-50%, -50%) 
    translateY(var(--shop-vertical-offset))
    scale(1.05); /* Slight scale up on hover */
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.shop-button:active {
  transform: 
    translate(-50%, -50%) 
    translateY(var(--shop-vertical-offset))
    scale(0.95); /* Scale down when clicked */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.logout-button:hover {
  background-color: #A04545; /* Lighter red on hover */
  color: #FFB8B8; /* Even lighter text on hover */
  transform: 
    translate(-50%, -50%) 
    translateY(var(--logout-vertical-offset))
    scale(1.05); /* Slight scale up on hover */
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.logout-button:active {
  transform: 
    translate(-50%, -50%) 
    translateY(var(--logout-vertical-offset))
    scale(0.95); /* Scale down when clicked */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Newspaper positioning */
.newspaper {
  position: absolute;
  right: calc(95% + 20px); /* position to the left of the 90% width lower-container */
  bottom: 50px; /* position near the lower-container */
  width: 100px;
  height: auto;
  z-index: 1; /* behind lower-container (z-index: 5) */
  pointer-events: none;
  transform: 
    translateX(var(--newspaper-offset-x)) 
    translateY(var(--newspaper-offset-y)) 
    rotate(var(--newspaper-rotation)) 
    scale(var(--newspaper-scale));
  transform-origin: center center;
}

.newspaper img {
  width: 100%;
  height: auto;
  display: block;
}

/* Coin container positioning */
.coin-container {
  position: absolute;
  left: calc(10% - 20px); /* position to the left side near the lower-container */
  bottom: 80px; /* position near the lower-container */
  width: 80px;
  height: auto;
  z-index: 100; /* in front of everything, like the TV remote */
  pointer-events: none;
  transform: 
    translateX(var(--coin-offset-x)) 
    translateY(var(--coin-offset-y)) 
    scale(var(--coin-scale));
  transform-origin: center center;
  display: none; /* Hidden by default, shown when user is logged in */
}

.coin-container.visible {
  display: block;
}

.coin-container .coin-image {
  width: 100%;
  height: auto;
  display: block;
}

.coin-container .gold-amount {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #d2b48c; /* Light brown background */
  color: #2d1810; /* Dark brown text for contrast */
  box-shadow: 0 0 2px 2px rgba(45, 24, 16, 0.3); /* 2px fade out around border */
  font-family: 'Oswald', Arial, sans-serif;
  font-weight: 700;
  font-size: 8px; /* Small font size to fit container */
  padding: 2px 4px; /* Padding for breathing room around text */
  border-radius: 6px;
  white-space: nowrap;
  text-shadow: none;
  /* Dynamic sizing based on content */
  width: auto;
  height: auto;
  min-width: 16px; /* Minimum width for very small numbers */
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: transform 0.3s ease, color 0.3s ease;
}

/* Gold amount win animation */
.coin-container .gold-amount.gold-win {
  animation: goldWinPulse 1.5s ease-out;
}

@keyframes goldWinPulse {
  0% { 
    transform: translate(-50%, -50%) scale(1);
    color: #2d1810;
  }
  30% { 
    transform: translate(-50%, -50%) scale(1.3);
    color: #f39c12; /* Bright gold color */
  }
  60% { 
    transform: translate(-50%, -50%) scale(1.1);
    color: #f39c12;
  }
  100% { 
    transform: translate(-50%, -50%) scale(1);
    color: #2d1810;
  }
}

/* Dropping coin animation */
.dropping-coin {
  position: absolute;
  width: 40px; /* 2x larger than before (was 20px) */
  height: 40px; /* 2x larger than before (was 20px) */
  background-image: url('/shared/images/gold-coin-64.png');
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 101; /* Above coin container */
}

.dropping-coin.animate {
  animation: coinDrop 1.2s ease-in;
}

@keyframes coinDrop {
  0% {
    opacity: 1;
    transform: translateY(-80px) rotate(0deg); /* Start closer to container */
  }
  50% {
    opacity: 1;
    transform: translateY(-10px) rotate(180deg); /* Drop lower */
  }
  100% {
    opacity: 0;
    transform: translateY(30px) rotate(360deg); /* End lower than before */
  }
}

/* Parchment page styling for monsters section */
#monsters-section {
  width: 100%;
  background: #f5e6d3; /* parchment color */
  background-image: url('/shared/images/parchment-tex.png');
  border: 3px solid #472a13;
  border-radius: 12px;
  padding: 20px;
  color: #2d1810;
  font-family: serif;
  box-shadow: 
    inset 0 0 10px rgba(139, 105, 20, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.2);
  height: 500px; /* Fixed height to contain header + 2 rows of monsters */
  display: flex;
  flex-direction: column;
}

/* Arena header container with navigation buttons */
.arena-header {
  background: #3d2f1f; /* dark brown */
  background-image: url('/shared/images/parchment-dark-tex.png');
  margin: -20px -20px 20px -20px;
  padding: 15px 20px;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid #8b6914;
  flex-shrink: 0; /* Prevent header from shrinking */
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

/* Arena header title - Override global vintage styling */
.arena-header h3 {
  /* Reset vintage styling from global.css */
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  display: block !important;
  text-transform: none !important;
  
  /* Restore original arena styling */
  color: #dbc19c; /* light earthy cream color */
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  font-family: 'Oswald', Impact, "Arial Black", "Franklin Gothic Bold", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 4px;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  flex: 1;
}

/* Navigation buttons */
.nav-button {
  background: rgba(61, 47, 31, 0.8);
  color: #dbc19c;
  border: 2px solid #8b6914;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: 'Oswald', Arial, sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-button:hover {
  background: rgba(139, 105, 20, 0.9);
  color: #fff;
  border-color: #a67c00;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.nav-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Position navigation buttons */
.nav-button-left {
  margin-right: auto;
}

.nav-button-right {
  margin-left: auto;
}

/* Monster grid and cards */
.monster-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 16px;
  min-height: 128px;
  overflow-y: auto; /* Enable vertical scrolling */
  flex: 1; /* Take remaining space after header */
  padding-right: 8px; /* Space for scrollbar */
}

.loading, .error, .no-monsters {
  width: 100%;
  text-align: center;
  padding: 20px;
  color: #2d1810;
  font-style: italic;
  text-shadow: none;
}

.no-monsters {
  font-size: 1.5em; /* 1.5x larger text */
  font-style: normal; /* Remove italic for the no-monsters message */
}

.no-monsters .highlight-trigger {
  color: #8b6914; /* Dark gold color */
  text-decoration: none;
  font-weight: bold;
  font-family: 'Oswald', Arial, sans-serif;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.no-monsters .highlight-trigger:hover {
  background-color: rgba(139, 105, 20, 0.1);
  color: #a67c00; /* Lighter gold on hover */
  text-decoration: underline;
}

/* Highlight pulse effect for target elements */
.highlight-pulse {
  animation: highlightPulse 1.5s ease-in-out infinite;
  outline: 3px solid rgba(90, 143, 62, 0.8) !important;
  outline-offset: 2px;
}

@keyframes highlightPulse {
  0%, 100% {
    outline: 3px solid rgba(90, 143, 62, 0.8);
  }
  50% {
    outline: 3px solid rgba(90, 143, 62, 1);
  }
}

.error {
  color: #8b4513;
}

.monster-card {
  width: 140px;
  height: 160px;
  background: #f5e6d3; /* parchment color */
  background-image: url('/shared/images/parchment-tex.png');
  border: 2px solid #4d391c;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 
    inset 0 0 5px rgba(139, 105, 20, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.2);
}

.monster-card:not(.in-queue):not(.in-match):hover {
  transform: translateY(-2px);
  box-shadow: 
    inset 0 0 5px rgba(139, 105, 20, 0.3),
    0 4px 8px rgba(0, 0, 0, 0.3);
  /* border-color: #a67c00; */
}

/* Hover overlay - ready for future functionality */
.monster-card:not(.in-queue):not(.in-match)::after {
  content: "View Details";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(128, 90, 42, 0.9);
  color: #f5e6d3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-family: serif;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
  /* border-radius: 6px; */
}

.monster-card:not(.in-queue):not(.in-match):hover::after {
  opacity: 1;
}

.monster-image-container {
  width: 100px;
  height: 100px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 8px;
  /* border: 1px solid #8b6914; */
  /* border-radius: 4px; */
  /* background: rgba(245, 230, 211, 0.8); */
}

.monster-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.monster-name {
  font-weight: bold;
  font-size: 14px;
  font-family: 'Oswald', Arial, sans-serif;
  text-transform: uppercase;
  word-break: break-word;
  max-width: 100%;
  position: relative;
  color: #2d1810;
  text-shadow: none;
  letter-spacing: 0.5px;
  border-top: 1px solid #8b6914;
  padding-top: 6px;
  margin-top: 4px;
}

/* Status indicators - Earthy journal theme */
.monster-card.in-queue {
  border: 3px solid #d4842a;
  background-image: url('/shared/images/parchment-tex.png'), radial-gradient(circle, rgba(212, 132, 42, 0.1) 0%, transparent 70%);
}

.monster-card.in-match-queue {
  border: 3px solid #5a7c99;
  background-image: url('/shared/images/parchment-tex.png'), radial-gradient(circle, rgba(90, 124, 153, 0.1) 0%, transparent 70%);
}

.monster-card.in-ring {
  border: 3px solid #8b4513;
  background-image: url('/shared/images/parchment-tex.png'), radial-gradient(circle, rgba(139, 69, 19, 0.1) 0%, transparent 70%);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

.status-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #3E3E3E;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Hatch Reveal Modal */
.hatch-reveal-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.hatch-reveal-modal.visible {
  opacity: 1;
  visibility: visible;
}

.hatch-reveal-content {
  background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
  border: 3px solid #4CAF50;
  border-radius: 15px;
  padding: 30px;
  max-width: 500px;
  text-align: center;
  transform: scale(0.8);
  transition: transform 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.hatch-reveal-modal.visible .hatch-reveal-content {
  transform: scale(1);
}

.hatch-reveal-header h2 {
  color: #4CAF50;
  font-size: 2em;
  margin: 0 0 20px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hatch-reveal-body {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}

.monster-image img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  border-radius: 10px;
  border: 2px solid #666;
}

.monster-info {
  flex: 1;
  text-align: left;
}

.monster-info h3 {
  color: #fff;
  font-size: 1.5em;
  margin: 0 0 10px 0;
}

.monster-info p {
  color: #ccc;
  margin: 5px 0;
  font-size: 1.1em;
}

.hatch-reveal-footer {
  margin-top: 20px;
}

.hatch-reveal-close {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.hatch-reveal-close:hover {
  background: #45a049;
}

