/*
 * index.css - Custom Manga/Comic styling for Paldea Monopoly
 * Premium design featuring halftone dot-grids, thick comic borders, diagonal slices, 
 * action speech bubbles, and rich CSS animations.
 */

@import url('https://fonts.googleapis.com/css2?family=Luckiest+Guy&family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --comic-bg: #1A1C20;
  --panel-bg: #FFFFFF;
  --border-color: #000000;
  --accent-yellow: #FFDE00;
  --accent-blue: #3B4CCA;
  --accent-red: #E74C3C;
  --text-dark: #1F2A38;
  --text-light: #F4F6F7;
  
  --group-brown: #7B3F00;
  --group-light-blue: #87CEEB;
  --group-pink: #FF69B4;
  --group-orange: #FF8C00;
  --group-red: #FF0000;
  --group-yellow: #FFD700;
  --group-green: #008000;
  --group-dark-blue: #000080;
  
  --font-title: 'Luckiest Guy', cursive;
  --font-body: 'Outfit', sans-serif;
  --border-width: 3px;
  --box-shadow-comic: 6px 6px 0px #000000;
  --box-shadow-comic-small: 3px 3px 0px #000000;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: var(--comic-bg);
  color: var(--text-light);
  font-family: var(--font-body);
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Halftone dot texture background */
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 15%, transparent 16%);
  background-size: 16px 16px;
}

.victory-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 222, 0, 0.45), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(59, 76, 202, 0.45), transparent 26%),
    radial-gradient(circle at 50% 85%, rgba(231, 76, 60, 0.5), transparent 30%),
    rgba(5, 8, 15, 0.92);
}

.victory-card {
  position: relative;
  z-index: 2;
  width: min(880px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  background: #FFF;
  color: var(--text-dark);
  border: 6px solid #000;
  border-radius: 26px;
  box-shadow: 14px 14px 0 #000;
  padding: 28px;
  text-align: center;
  animation: victoryCardPop 0.55s cubic-bezier(0.18, 1.2, 0.32, 1);
}

.victory-cheer {
  font-family: var(--font-title);
  font-size: 2rem;
  animation: victoryCheer 0.75s ease-in-out infinite alternate;
}

.victory-title {
  font-family: var(--font-title);
  font-size: clamp(3.4rem, 10vw, 7.4rem);
  color: var(--accent-yellow);
  text-shadow: 4px 4px 0 #000, 8px 8px 0 var(--accent-red);
  letter-spacing: 2px;
  line-height: 0.95;
  margin: 8px 0 10px;
}

.victory-subtitle {
  font-size: 1.25rem;
  font-weight: 900;
  margin-bottom: 16px;
}

.victory-partner {
  width: 120px;
  height: 120px;
  margin: 0 auto 18px;
  background: #FEF9E7;
  border: 5px solid #000;
  border-radius: 50%;
  box-shadow: 6px 6px 0 #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.victory-partner img {
  width: 165%;
  height: 165%;
  object-fit: cover;
}

.victory-partner svg {
  width: 95%;
  height: 95%;
}

.victory-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.victory-stat-card {
  background: #F8F9F9;
  border: 3px solid #000;
  border-radius: 14px;
  box-shadow: var(--box-shadow-comic-small);
  padding: 12px;
}

.victory-stat-label {
  display: block;
  color: #5D6D7E;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.victory-stat-value {
  display: block;
  margin-top: 4px;
  font-family: var(--font-title);
  color: var(--accent-blue);
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}

.victory-defeated {
  background: #2C3E50;
  color: #FFF;
  border: 3px solid #000;
  border-radius: 14px;
  box-shadow: var(--box-shadow-comic-small);
  padding: 12px;
  margin: 14px 0 20px;
  font-weight: 800;
}

.victory-new-game {
  background: #2ECC71;
  color: #FFF;
  font-size: 1.15rem;
  min-width: 180px;
}

.victory-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 18px;
  background: var(--confetti-color);
  border: 1px solid rgba(0, 0, 0, 0.35);
  animation: confettiFall var(--fall-duration) linear infinite;
  animation-delay: var(--fall-delay);
  transform: rotate(var(--confetti-rotate));
}

.victory-balloon {
  position: absolute;
  z-index: 1;
  font-size: clamp(3rem, 9vw, 7rem);
  filter: drop-shadow(5px 7px 0 rgba(0, 0, 0, 0.45));
  animation: balloonFloat 3.5s ease-in-out infinite alternate;
}

.balloon-one {
  left: 8%;
  bottom: 8%;
}

.balloon-two {
  right: 8%;
  top: 12%;
  animation-delay: 0.45s;
}

.balloon-three {
  right: 16%;
  bottom: 10%;
  animation-delay: 0.9s;
}

@keyframes victoryCardPop {
  0% { opacity: 0; transform: scale(0.78) rotate(-2deg); }
  70% { opacity: 1; transform: scale(1.04) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes victoryCheer {
  from { transform: translateY(0) rotate(-2deg); }
  to { transform: translateY(-6px) rotate(2deg); }
}

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

@keyframes balloonFloat {
  from { transform: translateY(0) rotate(-4deg); }
  to { transform: translateY(-28px) rotate(5deg); }
}

@media (max-width: 760px) {
  .victory-card {
    padding: 20px;
  }

  .victory-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Container */
.game-container {
  width: 100vw;
  height: 100vh;
  max-width: 100%;
  max-height: 100%;
  display: grid;
  grid-template-columns: 1fr auto; /* Sized dynamically by the resizable sidebar */
  padding: 10px;
  gap: 15px;
  position: relative;
  overflow: hidden; /* Revert to hidden: only board panel scrolls */
}

/* Left panel: Board & Center Actions */
.main-area {
  display: flex;
  overflow: auto; /* Enable scrollbars on board panel overflow */
  scroll-behavior: smooth;
  position: relative;
  border: var(--border-width) solid var(--border-color);
  background-color: #E2E8F0;
  border-radius: 12px;
  box-shadow: var(--box-shadow-comic);
  padding: 15px;
}

/* Right panel: Player details & Stats (Academy Journal style) */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 320px;
  min-width: 220px;
  max-width: 480px;
  resize: horizontal; /* Draggable horizontal resize */
  overflow-x: hidden;
  overflow-y: auto; /* Enable scrollbar for overflow sidebar content */
  direction: rtl; /* Places the resize drag handle on the left edge */
  padding-left: 8px; /* Extra room for drag handle */
}

/* Reset children text direction inside sidebar back to normal */
.sidebar > * {
  direction: ltr;
}

/* Setup / Starter Selection Screen */
.setup-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  background-color: var(--comic-bg);
  background-image: radial-gradient(rgba(255, 222, 0, 0.1) 15%, transparent 16%);
  background-size: 20px 20px;
  z-index: 100;
  display: block;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.setup-box {
  background-color: var(--panel-bg);
  color: var(--text-dark);
  border: 4px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  max-width: 750px;
  width: 100%;
  box-shadow: 10px 10px 0px var(--border-color);
  text-align: center;
  margin: 0 auto 28px auto;
}

.setup-title {
  font-family: var(--font-title);
  font-size: 2.8rem;
  letter-spacing: 2px;
  color: var(--accent-blue);
  text-shadow: 3px 3px 0px var(--accent-yellow), 5px 5px 0px #000;
  margin-bottom: 20px;
}

.setup-input-group {
  margin-bottom: 25px;
}

.setup-input-group label {
  display: block;
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 8px;
  text-align: left;
}

.setup-input {
  width: 100%;
  padding: 12px 15px;
  border: 3px solid var(--border-color);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  outline: none;
  box-shadow: var(--box-shadow-comic-small);
  transition: all 0.2s;
}

.setup-input:focus {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px var(--border-color);
}

.starter-selection {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.starter-card {
  border: 3px solid var(--border-color);
  border-radius: 12px;
  padding: 15px 10px;
  cursor: pointer;
  background-color: #F8F9F9;
  transition: all 0.2s;
  position: relative;
  box-shadow: var(--box-shadow-comic-small);
}

.starter-card:hover {
  transform: translateY(-5px);
  box-shadow: 5px 5px 0px var(--border-color);
}

.starter-card.selected {
  background-color: var(--accent-yellow);
  border-color: var(--accent-blue);
  transform: translateY(-5px) scale(1.03);
  box-shadow: 6px 6px 0px var(--border-color);
}

.starter-img {
  width: 90px;
  height: 90px;
  margin: 0 auto 10px auto;
  border-radius: 50%;
  border: 3px solid #000;
  box-shadow: 2px 2px 0px #000;
  overflow: hidden;
  background-color: #FFF;
  display: flex;
  justify-content: center;
  align-items: center;
}

.starter-img img {
  width: 175%;
  height: 175%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.starter-name {
  font-family: var(--font-title);
  font-size: 1.2rem;
  margin-bottom: 5px;
  color: var(--text-dark);
}

.starter-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #FFF;
  text-transform: uppercase;
}

.type-grass { background-color: #2ECC71; }
.type-fire { background-color: #E74C3C; }
.type-water { background-color: #3498DB; }
.type-electric { background-color: #F1C40F; color: #000; }

.btn-start {
  font-family: var(--font-title);
  font-size: 1.8rem;
  padding: 12px 35px;
  background-color: #2ECC71;
  color: white;
  border: 3px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--box-shadow-comic);
  transition: all 0.15s;
}

.btn-start:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0px var(--border-color);
  background-color: #27AE60;
}

.btn-start:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px var(--border-color);
}

.save-slots-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 3px dashed #000;
}

.save-slots-title {
  font-family: var(--font-title);
  color: var(--accent-blue);
  text-shadow: 1.5px 1.5px 0 #000;
  font-size: 1.35rem;
  margin-bottom: 10px;
  text-align: left;
}

.save-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.save-slot-card {
  min-height: 168px;
  background: #F8F9F9;
  color: var(--text-dark);
  border: 3px solid #000;
  border-radius: 8px;
  box-shadow: var(--box-shadow-comic-small);
  padding: 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.save-slot-card.empty {
  background: #EAEDED;
  color: #5D6D7E;
}

.save-slot-label {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--accent-red);
}

.save-slot-trainer {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--accent-blue);
  text-shadow: 1px 1px 0 #000;
  overflow-wrap: anywhere;
}

.save-slot-time {
  font-size: 0.78rem;
  font-weight: 800;
}

.save-slot-summary {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  flex: 1;
  max-height: 82px;
  overflow-y: auto;
  padding-right: 3px;
}

.save-slot-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.save-slot-actions button {
  border: 3px solid #000;
  border-radius: 8px;
  box-shadow: var(--box-shadow-comic-small);
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 900;
  padding: 7px 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  text-transform: uppercase;
}

.save-action-primary {
  flex: 1;
  color: #FFF;
}

.save-action-new {
  background: #2ECC71;
}

.save-action-overwrite {
  background: var(--accent-yellow);
  color: #000;
}

.save-action-load {
  background: var(--accent-blue);
}

.save-action-delete {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 0;
  background: var(--accent-red);
  color: #FFF;
  border-radius: 50%;
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0.78;
}

.save-slot-actions button:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}

.save-action-delete:hover:not(:disabled) {
  opacity: 1;
}

.save-slot-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


/* --- Monopoly Board Grid --- */
.monopoly-board {
  display: grid;
  grid-template-columns: 1.54fr repeat(9, 1fr) 1.54fr;
  grid-template-rows: 1.54fr repeat(9, 1fr) 1.54fr;
  width: 980px;
  height: 980px;
  min-width: 980px;
  min-height: 980px;
  aspect-ratio: 1 / 1;
  background-color: #FAF7ED;
  border: 3.5px solid var(--border-color);
  position: relative;
  box-shadow: var(--box-shadow-comic);
  flex-shrink: 0;
  margin: auto;
}

/* Individual Tiles */
.tile {
  background-color: #FAF7ED;
  border: 2.5px solid var(--border-color);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-dark);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.1s;
  padding: 0 !important; /* paddings handled inside .tile-content wrapper */
}

.tile:hover {
  transform: scale(1.02);
  z-index: 10;
  box-shadow: 0px 0px 8px rgba(0,0,0,0.3);
}

/* Core container for intermediate tile contents to support layout rotation (original board style) */
.tile-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 6px 2px 2px 2px; /* standard padding for cells without color bars */
  z-index: 1;
}

/* Pad properties to clear the 14px color bar at the local top */
.tile:not(.corner) .tile-content {
  padding-top: 18px;
}

/* Corner content centers items and supports rotation layout */
.tile-content.corner-content {
  justify-content: center;
  padding: 0;
  width: 100%;
  height: 100%;
}

/* Rotations for side columns and top row to face the center of the board */
.tile.side-bottom:not(.corner) .tile-content {
  width: 100%;
  height: 100%;
}

.tile.side-left:not(.corner) .tile-content {
  width: 81px;   /* physical height of intermediate side tile */
  height: 125px; /* physical width of intermediate side tile */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
}

.tile.side-top:not(.corner) .tile-content {
  width: 100%;
  height: 100%;
  transform: rotate(180deg);
}

.tile.side-right:not(.corner) .tile-content {
  width: 81px;   /* physical height of intermediate side tile */
  height: 125px; /* physical width of intermediate side tile */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
}

/* Color group bars - globally absolute positioned at local top */
.tile-color-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  z-index: 2;
  border-bottom: 2.5px solid var(--border-color);
}

/* Base style for icon - fixed height for uniformity and large sprites */
.tile-icon {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  pointer-events: none;
  padding: 2px;
  flex-shrink: 0;
}

.tile:not(.corner) .tile-icon {
  height: 60px; /* fixed height makes all sprites large and identical in size */
}

.tile-icon img {
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 2px solid #000;
  border-radius: 8px;
}

.tile-icon svg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tile-name {
  text-align: center;
  width: calc(100% - 4px);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-dark);
  margin-top: 2px;
  word-wrap: break-word;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex-shrink: 0;
  z-index: 2;
  height: 2.2em; /* Fixed height of 2 lines aligns layout perfectly */
}

.tile-price {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 2px;
  flex-shrink: 0;
  z-index: 2;
  border-radius: 4px;
  padding: 2px 6px;
  transition: background-color 0.2s, color 0.2s;
}

/* Grid Coordinates for the 40 Monopoly spaces */
/* Corners */
.tile[data-id="0"]  { grid-column: 11; grid-row: 11; } /* GO */
.tile[data-id="10"] { grid-column: 1;  grid-row: 11; } /* Jail */
.tile[data-id="20"] { grid-column: 1;  grid-row: 1;  } /* Free Parking */
.tile[data-id="30"] { grid-column: 11; grid-row: 1;  } /* Go to Jail */

/* Bottom Row (Right to Left: 1 to 9) */
.tile[data-id="1"]  { grid-column: 10; grid-row: 11; }
.tile[data-id="2"]  { grid-column: 9;  grid-row: 11; }
.tile[data-id="3"]  { grid-column: 8;  grid-row: 11; }
.tile[data-id="4"]  { grid-column: 7;  grid-row: 11; }
.tile[data-id="5"]  { grid-column: 6;  grid-row: 11; }
.tile[data-id="6"]  { grid-column: 5;  grid-row: 11; }
.tile[data-id="7"]  { grid-column: 4;  grid-row: 11; }
.tile[data-id="8"]  { grid-column: 3;  grid-row: 11; }
.tile[data-id="9"]  { grid-column: 2;  grid-row: 11; }

/* Left Column (Bottom to Top: 11 to 19) */
.tile[data-id="11"] { grid-column: 1; grid-row: 10; }
.tile[data-id="12"] { grid-column: 1; grid-row: 9;  }
.tile[data-id="13"] { grid-column: 1; grid-row: 8;  }
.tile[data-id="14"] { grid-column: 1; grid-row: 7;  }
.tile[data-id="15"] { grid-column: 1; grid-row: 6;  }
.tile[data-id="16"] { grid-column: 1; grid-row: 5;  }
.tile[data-id="17"] { grid-column: 1; grid-row: 4;  }
.tile[data-id="18"] { grid-column: 1; grid-row: 3;  }
.tile[data-id="19"] { grid-column: 1; grid-row: 2;  }

/* Top Row (Left to Right: 21 to 29) */
.tile[data-id="21"] { grid-column: 2;  grid-row: 1; }
.tile[data-id="22"] { grid-column: 3;  grid-row: 1; }
.tile[data-id="23"] { grid-column: 4;  grid-row: 1; }
.tile[data-id="24"] { grid-column: 5;  grid-row: 1; }
.tile[data-id="25"] { grid-column: 6;  grid-row: 1; }
.tile[data-id="26"] { grid-column: 7;  grid-row: 1; }
.tile[data-id="27"] { grid-column: 8;  grid-row: 1; }
.tile[data-id="28"] { grid-column: 9;  grid-row: 1; }
.tile[data-id="29"] { grid-column: 10; grid-row: 1; }

/* Right Column (Top to Bottom: 31 to 39) */
.tile[data-id="31"] { grid-column: 11; grid-row: 2; }
.tile[data-id="32"] { grid-column: 11; grid-row: 3; }
.tile[data-id="33"] { grid-column: 11; grid-row: 4; }
.tile[data-id="34"] { grid-column: 11; grid-row: 5; }
.tile[data-id="35"] { grid-column: 11; grid-row: 6; }
.tile[data-id="36"] { grid-column: 11; grid-row: 7; }
.tile[data-id="37"] { grid-column: 11; grid-row: 8; }
.tile[data-id="38"] { grid-column: 11; grid-row: 9; }
.tile[data-id="39"] { grid-column: 11; grid-row: 10; }

/* Special space styling - targeting the correct class from ui.js */
.tile.corner {
  font-family: var(--font-title);
  font-size: 0.85rem;
  background-color: #EAEDED;
  justify-content: center;
  padding: 0;
}

.tile.corner .tile-icon {
  width: 100%;
  height: 100%;
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  opacity: 1;
  padding: 0;
}

.tile.corner .tile-icon img {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  border-radius: 0 !important;
  object-fit: cover !important;
}

.tile.corner .tile-name {
  display: none;
}

/* Corner orientations facing inward to the center */
.tile[data-id="0"] .tile-content.corner-content {
  transform: rotate(0deg);
}
.tile[data-id="10"] .tile-content.corner-content {
  transform: rotate(90deg);
}
.tile[data-id="20"] .tile-content.corner-content {
  transform: rotate(180deg);
}
.tile[data-id="30"] .tile-content.corner-content {
  transform: rotate(270deg);
}

/* Counter-rotations for player tokens to keep them upright (0deg) */
.tile.side-left .player-token {
  transform: rotate(-90deg);
}
.tile.side-top .player-token {
  transform: rotate(-180deg);
}
.tile.side-right .player-token {
  transform: rotate(90deg);
}

/* Colors for groups */
.tile-color-bar.brown { background-color: var(--group-brown); }
.tile-color-bar.light-blue { background-color: var(--group-light-blue); }
.tile-color-bar.pink { background-color: var(--group-pink); }
.tile-color-bar.orange { background-color: var(--group-orange); }
.tile-color-bar.red { background-color: var(--group-red); }
.tile-color-bar.yellow { background-color: var(--group-yellow); }
.tile-color-bar.green { background-color: var(--group-green); }
.tile-color-bar.dark-blue { background-color: var(--group-dark-blue); }

/* Soft Cream Backgrounds for all properties, distinct category tints for others */
.tile.brown { background-color: #FAF7ED; }
.tile.light-blue { background-color: #FAF7ED; }
.tile.pink { background-color: #FAF7ED; }
.tile.orange { background-color: #FAF7ED; }
.tile.red { background-color: #FAF7ED; }
.tile.yellow { background-color: #FAF7ED; }
.tile.green { background-color: #FAF7ED; }
.tile.dark-blue { background-color: #FAF7ED; }
.tile.station { background-color: #EAECEE; }
.tile.utility { background-color: #FCF3CF; }
.tile.tax { background-color: #FDEDEC; }
.tile.card { background-color: #FCF3CF; }
.tile.corner { background-color: #EAEDED; }

/* Tokens overlay in the center of the tile */
.token-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: 76px;
  height: 76px;
  pointer-events: none;
  z-index: 4;
}

.player-token {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px solid var(--player-color, #000);
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 2px 2px 0px #000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin: -4px; /* Slight overlapping cluster style */
  transition: all 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.player-token img {
  width: 175%;
  height: 175%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.player-token svg {
  width: 90%;
  height: 90%;
}

/* Real Estate House Indicators absolute positioned inside color bar */
.buildings-container {
  position: absolute;
  pointer-events: none;
  z-index: 3;
}

.tile.side-bottom .buildings-container {
  top: 0; left: 0; right: 0; height: 16px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  gap: 3px;
}

.tile.side-top .buildings-container {
  bottom: 0; left: 0; right: 0; height: 16px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 3px;
}

.tile.side-left .buildings-container {
  top: 0; bottom: 0; right: 0; width: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 3px;
}

.tile.side-right .buildings-container {
  top: 0; bottom: 0; left: 0; width: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 3px;
}

/* Building visual tokens (Camps / Tents) */
.building-camp {
  width: 12px;
  height: 12px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.building-camp.filled {
  animation: building-appear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.building-camp.placeholder {
  opacity: 0.25;
}

.camp-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(1px 1px 0px rgba(0,0,0,0.3));
}

.camp-svg-placeholder {
  width: 100%;
  height: 100%;
}

/* Building visual tokens (Gym Stations / Hotels) */
.building-gym {
  width: 18px;
  height: 18px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: building-appear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.gym-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(1.5px 1.5px 0px rgba(0,0,0,0.4));
}

/* Animation for building appearance */
@keyframes building-appear {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  70% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mortgage overlay */
.mortgage-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  color: #FFF;
  font-family: var(--font-title);
  font-size: 0.75rem;
  letter-spacing: 1px;
  transform: rotate(-15deg);
  pointer-events: none;
}


/* --- Center Board Action Zone --- */
.board-center {
  grid-column: 2 / 11;
  grid-row: 2 / 11;
  background-color: #FAF7ED;
  background-image: url('images/logo.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border: 3px solid var(--border-color);
  padding: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0px 0px 20px rgba(0, 0, 0, 0.12);
}

.center-dashboard-panel {
  background-color: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 4px solid var(--border-color);
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: var(--box-shadow-comic);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  max-width: 500px;
  width: 95%;
  margin: auto;
  z-index: 5;
}

/* Center Panel Header Logo */
.center-logo-box {
  display: none;
}

.center-logo {
  font-family: var(--font-title);
  font-size: 2.2rem;
  letter-spacing: 1px;
  color: var(--accent-yellow);
  text-shadow: 2.5px 2.5px 0px var(--accent-blue), 4px 4px 0px #000;
  transform: rotate(-4deg);
  margin-bottom: 2px;
  display: inline-block;
}

.center-sublogo {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-dark);
}

/* Dice Container */
.dice-zone {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 15px 0;
}

.comic-die {
  width: 72px;
  height: 72px;
  background-color: #FFF;
  border: 3.5px solid #000;
  border-radius: 12px;
  box-shadow: var(--box-shadow-comic-small);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-title);
  font-size: 2.5rem;
  color: var(--text-dark);
  transition: transform 0.5s;
}

.die-dot {
  background-color: #000;
  border-radius: 50%;
  width: 9px;
  height: 9px;
  opacity: 0;
  margin: auto;
}

.die-dot.active {
  opacity: 1;
}

.comic-die.rolling {
  animation: rollAnimation 0.5s infinite linear;
}

@keyframes rollAnimation {
  0% { transform: rotate(0deg) scale(0.9); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(0.9); }
}

/* Action controls */
.action-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.btn-comic {
  font-family: var(--font-title);
  font-size: 1.25rem;
  padding: 10px 24px;
  border: 3px solid #000;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--box-shadow-comic-small);
  transition: all 0.1s;
  background-color: #FFF;
  color: var(--text-dark);
}

.btn-comic:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0px #000;
}

.btn-comic:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #000;
}

.btn-comic:disabled {
  background-color: #D2D7D9 !important;
  color: #8A9597 !important;
  border-color: #8A9597 !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.btn-roll { background-color: var(--accent-yellow); }
.btn-buy { background-color: #2ECC71; color: white; }
.btn-build { background-color: #9B59B6; color: white; }
.btn-mortgage { background-color: #E67E22; color: white; }
.btn-end { background-color: #BDC3C7; }

.action-box #quick-save-game-btn,
.action-box #quick-load-game-btn,
.action-box .btn-save-action,
.action-box .btn-load-action {
  display: none !important;
}

/* Status dialogue bubble in center */
.dialogue-bubble {
  background-color: #FFF;
  border: 3px solid #000;
  border-radius: 16px;
  padding: 14px 20px;
  color: var(--text-dark);
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: var(--box-shadow-comic);
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  line-height: 1.4;
}

.dialogue-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: #000 transparent;
  display: block;
  width: 0;
}

.dialogue-bubble::before {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px 8px 0;
  border-style: solid;
  border-color: #FFF transparent;
  display: block;
  width: 0;
  z-index: 1;
}

/* Turn Speaker Avatar inside bubble */
.dialogue-avatar {
  width: 150px;
  height: 150px;
  border: 4.5px solid #000;
  border-radius: 50%;
  box-shadow: 4px 4px 0px #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  background-color: #FFF;
  position: relative;
}

.dialogue-avatar img {
  width: 175%;
  height: 175%;
  object-fit: cover;
  object-position: center;
}

.dialogue-avatar svg {
  width: 90%;
  height: 90%;
}

.dialogue-text {
  flex-grow: 1;
  text-align: left;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.45;
  color: #2C3E50;
}

/* Center panel relative alignment */
.center-dashboard-panel {
  position: relative; /* Ensure container-absolute alignment works */
}

/* Pop-up Utility Menu (top right, next to sound) */
.utility-menu-container {
  position: absolute;
  top: 15px;
  right: 58px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 6;
}

.btn-utility-toggle {
  width: 32px;
  height: 32px;
  background-color: var(--accent-blue);
  color: white;
  border: 2px solid #000;
  border-radius: 50%;
  box-shadow: 2px 2px 0px #000;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-utility-toggle:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #000;
}

.btn-utility-toggle:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #000;
}

.utility-popup-menu {
  background: #FFF;
  border: 3px solid #000;
  border-radius: 12px;
  box-shadow: var(--box-shadow-comic-small);
  padding: 8px;
  display: none; /* toggled by JS */
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  position: absolute;
  top: 32px;
  right: 0;
  animation: menuPopIn 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes menuPopIn {
  0% { transform: scale(0.8) translateY(-10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.utility-popup-menu .menu-item {
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 6px 12px;
  border: 2px solid #000;
  border-radius: 8px;
  box-shadow: 2px 2px 0px #000;
  cursor: pointer;
  color: #FFF;
  text-align: left;
  width: 120px;
  transition: all 0.1s;
}

.utility-popup-menu .menu-item:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #000;
}

.utility-popup-menu .menu-item:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #000;
}

.utility-popup-menu .btn-build {
  background-color: #9B59B6;
}

.utility-popup-menu .btn-save {
  background-color: #2ECC71;
}

.utility-popup-menu #load-game-btn {
  background-color: var(--accent-blue);
}

.utility-popup-menu .btn-mortgage {
  background-color: #E67E22;
}

/* Big Encounter Sprite Card */
.encounter-sprite-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #FFF 40%, #EBF5FB 100%);
  border: 4px solid #000;
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--box-shadow-comic);
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  animation: encounterEntrance 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both,
             encounterFloat 3s ease-in-out 0.5s infinite;
}

@keyframes encounterEntrance {
  0% {
    transform: scale(0.1) rotate(-15deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.15) rotate(5deg);
  }
  90% {
    transform: scale(0.98) rotate(-2deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes encounterFloat {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(0.5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes titlePulse {
  0% { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1.05) rotate(2deg); }
}

.encounter-sprite-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  color: #FF2E2E;
  text-shadow: 3px 3px 0px #000, -1px -1px 0px #000, 1px -1px 0px #000, -1px 1px 0px #000;
  margin-bottom: 12px;
  letter-spacing: 1.5px;
  font-weight: 900;
  text-transform: uppercase;
  display: inline-block;
  transform: rotate(-1.5deg);
  animation: titlePulse 1s ease-in-out infinite alternate;
}

.encounter-sprite-image-wrapper {
  width: 165px;
  height: 165px;
  border: 4.5px solid #000;
  border-radius: 24px;
  box-shadow: 4px 4px 0px #000;
  background-color: #FFF;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.encounter-sprite-image-wrapper img,
.encounter-sprite-image-wrapper svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.encounter-sprite-name {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: #2C3E50;
  text-shadow: 1px 1px 0px #BDC3C7;
  letter-spacing: 0.5px;
  font-weight: 800;
}

.center-action-toast {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 120;
  min-width: 220px;
  max-width: 80%;
  padding: 12px 18px;
  border: 4px solid #000;
  border-radius: 14px;
  background: #FFF;
  color: var(--text-dark);
  box-shadow: 6px 6px 0 #000;
  font-family: var(--font-title);
  font-size: 1.35rem;
  text-align: center;
  pointer-events: none;
  animation: centerToastPop 1.55s ease-out forwards;
}

.center-action-toast.money {
  background: #2ECC71;
  color: #FFF;
}

.center-action-toast.damage {
  background: #E74C3C;
  color: #FFF;
}

.center-action-toast.super {
  background: #F1C40F;
  color: #000;
}

@keyframes centerToastPop {
  0% { opacity: 0; transform: translate(-50%, -35%) scale(0.75) rotate(-2deg); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(1deg); }
  75% { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -75%) scale(0.92); }
}

/* Action box flex ordering */
#end-turn-btn {
  order: 2;
}

/* Secondary small Buy at Full styling */
#buy-prop-btn.btn-buy-small,
#pay-rent-btn.btn-buy-small {
  background-color: #2ECC71;
  color: white;
  padding: 6px 14px;
  font-size: 0.85rem;
  border: 2px solid #000;
  border-radius: 8px;
  box-shadow: 2px 2px 0px #000;
  width: 100%;
  max-width: 220px;
  margin: 10px auto 0 auto;
  order: 3;
}

#buy-prop-btn.btn-buy-small:hover,
#pay-rent-btn.btn-buy-small:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #000;
}

#buy-prop-btn.btn-buy-small:active,
#pay-rent-btn.btn-buy-small:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #000;
}

/* Highlighted Battle button styling */
.btn-battle-highlight {
  background-color: #F1C40F !important; /* Gold/Yellow background */
  color: #000 !important;
  border: 3.5px solid #000 !important;
  box-shadow: 3px 3px 0px #000 !important;
  font-size: 1.15rem !important;
  padding: 10px 22px !important;
  animation: pulseBattle 1.5s infinite alternate;
  order: 1;
}

@keyframes pulseBattle {
  0% {
    transform: scale(1);
    box-shadow: 3px 3px 0px #000 !important;
  }
  100% {
    transform: scale(1.05);
    box-shadow: 5px 5px 0px #000, 0 0 12px rgba(241, 196, 15, 0.5) !important;
  }
}

/* Sound and mute indicator */
.mute-toggle {
  position: absolute;
  top: 15px;
  right: 15px;
  cursor: pointer;
  background: white;
  border: 2px solid #000;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1rem;
  z-index: 5;
  box-shadow: var(--box-shadow-comic-small);
}


/* --- Sidebar Trainer Cards & Logs --- */
.trainer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trainer-card {
  background-color: var(--panel-bg);
  color: var(--text-dark);
  border: 3px solid #000;
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: var(--box-shadow-comic-small);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.trainer-card.active {
  background-color: var(--accent-yellow);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px #000;
}

.trainer-card.bankrupt {
  opacity: 0.5;
  background-color: #CCD1D1;
  text-decoration: line-through;
}

.trainer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background-color: var(--trainer-color, #333);
}

.trainer-info-left {
  display: flex;
  flex-direction: column;
}

.trainer-card-name {
  font-weight: 800;
  font-size: 0.9rem;
}

.trainer-card-partner {
  font-size: 0.7rem;
  color: #566573;
}

.trainer-card-cash {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: #27AE60;
  text-shadow: 1px 1px 0px #000;
}

/* Pokémon Collection & Trading Panel */
.collection-panel {
  background-color: var(--panel-bg);
  border: 3px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: var(--box-shadow-comic-small);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.collection-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
  justify-content: flex-start;
}

.collection-item {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  border: 2.5px solid var(--border-color);
  background-color: #FFF;
  box-shadow: 1.5px 1.5px 0px #000;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s, background-color 0.15s;
}

.collection-item img {
  width: 175%;
  height: 175%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.collection-item svg {
  width: 90%;
  height: 90%;
}

.collection-item.selected {
  border-color: #E67E22;
  background-color: #FDEBD0;
  transform: scale(1.08);
  box-shadow: 2px 2px 0px #E67E22;
}

.collection-item.locked {
  border-color: #5D6D7E;
  background-color: #D5DBDB;
}

.collection-item.locked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgba(44, 62, 80, 0.12),
    rgba(44, 62, 80, 0.12) 6px,
    transparent 6px,
    transparent 12px
  );
  pointer-events: none;
}

.collection-lock-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border: 2px solid #000;
  border-radius: 50%;
  background: #FFF;
  box-shadow: 1px 1px 0 #000;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
}

.collection-lock-btn.locked {
  background: var(--accent-yellow);
}

.collection-partner-btn {
  position: absolute;
  top: -4px;
  left: -4px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border: 2px solid #000;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #FFF;
  box-shadow: 1px 1px 0 #000;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}

.collection-item:hover {
  transform: scale(1.08);
}

.trade-controls {
  display: flex;
  gap: 8px;
}

.trade-hint {
  font-size: 0.72rem;
  font-weight: 800;
  color: #5D6D7E;
  text-align: center;
  margin-top: -4px;
}

.btn-trade {
  flex: 1;
  font-family: var(--font-title);
  font-size: 0.75rem;
  padding: 6px 4px;
  border: 2.5px solid #000;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: var(--box-shadow-comic-small);
  font-weight: 800;
  text-align: center;
  transition: all 0.1s;
  background-color: var(--accent-yellow);
  color: #000;
}

.btn-trade-power.ready {
  background-color: #2ECC71;
  color: #FFF;
}

.btn-trade-evolve.ready {
  background-color: var(--accent-yellow);
  color: #000;
}

.btn-trade:active:not(.disabled) {
  transform: translate(1.5px, 1.5px);
  box-shadow: none;
}

.btn-trade.disabled {
  background-color: #BDC3C7 !important;
  color: #7F8C8D !important;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.move-learn-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.move-learn-modal {
  width: min(760px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  background: #FFF;
  color: var(--text-dark);
  border: 4px solid #000;
  border-radius: 16px;
  box-shadow: 8px 8px 0 #000;
  padding: 18px;
}

.move-learn-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--accent-blue);
  text-shadow: 2px 2px 0 #000;
}

.move-learn-subtitle {
  font-weight: 800;
  margin: 8px 0 14px;
}

.move-learn-section-title {
  font-family: var(--font-title);
  color: var(--accent-red);
  margin: 14px 0 8px;
  letter-spacing: 0.5px;
}

.move-learn-grid,
.move-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.move-learn-card,
.move-slot-card,
.evolution-target-card {
  background: #F8F9F9;
  color: var(--text-dark);
  border: 3px solid #000;
  border-radius: 10px;
  box-shadow: var(--box-shadow-comic-small);
  padding: 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.move-learn-card.selected,
.move-slot-card.selected,
.evolution-target-card.selected {
  background: #FEF9E7;
  border-color: var(--accent-blue);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}

.move-learn-name {
  font-family: var(--font-title);
  font-size: 1rem;
}

.move-learn-power,
.move-learn-text,
.move-slot-label,
.evolution-target-label,
.evolution-arrow {
  font-size: 0.8rem;
  font-weight: 800;
}

.evolution-target-label {
  color: var(--accent-blue);
}

.evolution-arrow {
  color: #27AE60;
}

.evolution-target-visuals {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.evolution-target-sprite {
  width: 56px;
  height: 56px;
  background: #fff;
  border: 3px solid #000;
  border-radius: 12px;
  box-shadow: 2px 2px 0 #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.evolution-target-sprite img {
  width: 150%;
  height: 150%;
  object-fit: cover;
}

.evolution-target-sprite svg {
  width: 100%;
  height: 100%;
  transform: scale(1.08);
}

.evolution-target-arrow-big {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: #27AE60;
  text-shadow: 1px 1px 0 #000;
}

.evolution-target-bonus {
  background: #FEF9E7;
  color: #27AE60;
  font-family: var(--font-title);
  font-size: 1.1rem;
}

.move-learn-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.move-learn-cancel {
  background: #BDC3C7;
}

.move-learn-confirm {
  background: #2ECC71;
  color: #FFF;
}

/* Live Logs Box */
.logs-panel {
  background-color: #000;
  color: #2ECC71;
  border: 3px solid #333;
  border-radius: 10px;
  padding: 10px;
  flex-grow: 1;
  font-family: monospace;
  font-size: 0.75rem;
  overflow-y: auto;
  height: 250px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-entry {
  line-height: 1.3;
}


/* --- Battle Modal Screen (Comic Layout) --- */
.battle-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 50;
  display: none;
  grid-template-rows: 70% 30%;
  overflow: hidden;
}

.battle-arena {
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  background-color: #34495E;
  /* Comic Speed lines background */
  background-image: repeating-radial-gradient(circle, transparent, transparent 10px, rgba(255,255,255,0.05) 10px, rgba(255,255,255,0.05) 20px);
}

/* Split panels */
.battle-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  position: relative;
  transition: transform 0.3s;
}

/* Diagonal divider overlay */
.battle-arena::before {
  content: '';
  position: absolute;
  top: 0;
  left: 48%;
  width: 4%;
  height: 100%;
  background-color: #000;
  transform: skewX(-15deg);
  z-index: 2;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.8);
}

/* Specific sides */
.player-side {
  background-color: #1A5276;
  clip-path: polygon(0 0, 102% 0, 85% 100%, 0% 100%);
  z-index: 1;
}

.enemy-side {
  background-color: #7B241C;
  clip-path: polygon(15% 0, 100% 0, 100% 100%, -2% 100%);
}

.battle-sprite-container {
  width: 280px;
  height: 280px;
  margin-bottom: 20px;
  position: relative;
}

.battle-sprite-container.shake {
  animation: shakeAnimation 0.15s repeat 2;
}

@keyframes shakeAnimation {
  0% { transform: translate(2px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(0px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(2px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(2px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* HP Bars */
.battle-hud {
  width: 280px;
  background-color: #FFF;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 10px;
  box-shadow: var(--box-shadow-comic-small);
  color: var(--text-dark);
}

.battle-name {
  font-family: var(--font-title);
  font-size: 1.3rem;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
}

.hp-bar-bg {
  width: 100%;
  height: 14px;
  background-color: #E5E8E8;
  border: 2px solid #000;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.hp-bar-fill {
  height: 100%;
  background-color: #2ECC71;
  width: 100%;
  transition: width 0.4s ease;
}

.hp-text {
  font-size: 0.75rem;
  font-weight: 800;
  text-align: right;
  margin-top: 2px;
}

/* Battle controls footer */
.battle-footer {
  background-color: #111;
  border-top: 4px solid #000;
  padding: 15px;
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 15px;
}

.battle-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* Move Elemental Type tags styling */
.move-type-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-right: 6px;
  color: white;
  border: 1px solid #000;
  vertical-align: middle;
}
.move-type-tag.grass { background-color: #2ECC71; }
.move-type-tag.fire { background-color: #E74C3C; }
.move-type-tag.water { background-color: #3498DB; }
.move-type-tag.electric { background-color: #F1C40F; color: #000; }
.move-type-tag.normal { background-color: #95A5A6; }
.move-type-tag.fairy { background-color: #FF80AB; color: #000; }
.move-type-tag.ghost { background-color: #705898; }
.move-type-tag.fighting { background-color: #C03028; }
.move-type-tag.ground { background-color: #E0C068; color: #000; }
.move-type-tag.steel { background-color: #B8B8D0; color: #000; }
.move-type-tag.dark { background-color: #705848; }
.move-type-tag.bug { background-color: #A8B820; }
.move-type-tag.flying { background-color: #A890F0; }
.move-type-tag.rock { background-color: #B8A038; }
.move-type-tag.dragon { background-color: #7038F8; }
.move-type-tag.poison { background-color: #A040A0; }
.move-type-tag.ice { background-color: #98D8D8; color: #000; }
.move-type-tag.psychic { background-color: #F85888; }

.mystery-encounter-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 222, 0, 0.42), transparent 22%),
    radial-gradient(circle at 82% 78%, rgba(59, 76, 202, 0.38), transparent 24%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
}

.mystery-card {
  width: min(760px, 96vw);
  background: #FFF;
  color: var(--text-dark);
  border: 5px solid #000;
  border-radius: 20px;
  box-shadow: 10px 10px 0 #000;
  padding: 18px;
  animation: mysteryPop 0.28s cubic-bezier(0.18, 1.2, 0.32, 1);
}

.mystery-card.shiny {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.98), rgba(255,245,180,0.96)),
    radial-gradient(circle, rgba(255, 222, 0, 0.28), transparent 60%);
}

.mystery-kicker {
  font-weight: 900;
  color: #5D6D7E;
  margin-bottom: 5px;
}

.mystery-title {
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--accent-yellow);
  text-shadow: 2px 2px 0 #000, 4px 4px 0 var(--accent-red);
}

.mystery-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: center;
  margin: 14px 0;
}

.mystery-sprite {
  width: 170px;
  height: 170px;
  border: 4px solid #000;
  border-radius: 18px;
  box-shadow: var(--box-shadow-comic);
  background: #F8F9F9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.mystery-sprite.shiny::after,
.collection-item.shiny::after {
  content: "✦";
  position: absolute;
  top: 4px;
  left: 6px;
  color: #FFDE00;
  font-size: 1.2rem;
  text-shadow: 1px 1px 0 #000;
  animation: shinyTwinkle 0.85s ease-in-out infinite alternate;
  pointer-events: none;
}

.mystery-sprite img {
  width: 155%;
  height: 155%;
  object-fit: cover;
}

.mystery-sprite svg {
  width: 100%;
  height: 100%;
}

.mystery-fallback-sprite {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(-45deg, rgba(0,0,0,0.08) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #F8F9F9, #D6EAF8);
}

.mystery-fallback-sprite span {
  font-family: var(--font-title);
  font-size: 3rem;
  color: var(--accent-blue);
  text-shadow: 2px 2px 0 #000;
}

.mystery-name {
  font-family: var(--font-title);
  font-size: 1.45rem;
}

.mystery-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.mystery-tag {
  display: inline-block;
  border: 2px solid #000;
  border-radius: 999px;
  padding: 2px 8px;
  background: #ECF0F1;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 1px 1px 0 #000;
}

.mystery-tag.shiny {
  background: var(--accent-yellow);
}

.mystery-quirk,
.mystery-note {
  margin-top: 8px;
  font-weight: 800;
}

.mystery-note {
  color: #27AE60;
}

.mystery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.mystery-actions .mystery-battle {
  background: var(--accent-red);
  color: #FFF;
}

.mystery-actions .mystery-bait {
  background: var(--accent-yellow);
}

.mystery-actions .mystery-watch {
  background: var(--accent-blue);
  color: #FFF;
}

.mystery-actions .mystery-ignore {
  background: #BDC3C7;
}

.collection-meta-badges {
  position: absolute;
  left: -4px;
  bottom: -4px;
  z-index: 3;
  display: flex;
  gap: 2px;
}

.collection-meta-badge {
  width: 16px;
  height: 16px;
  border: 1.5px solid #000;
  border-radius: 50%;
  background: #FFF;
  color: #000;
  font-size: 0.55rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 1px 1px 0 #000;
}

.collection-meta-badge.shiny {
  background: var(--accent-yellow);
}

.collection-meta-badge.quirk {
  background: #2ECC71;
  color: #FFF;
}

@keyframes mysteryPop {
  0% { opacity: 0; transform: scale(0.86) rotate(-1.5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes shinyTwinkle {
  from { transform: scale(0.8) rotate(-8deg); opacity: 0.65; }
  to { transform: scale(1.25) rotate(8deg); opacity: 1; }
}

@media (max-width: 700px) {
  .mystery-body {
    grid-template-columns: 1fr;
  }

  .mystery-sprite {
    margin: 0 auto;
  }
}

.btn-move {
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-title);
  font-size: 1.1rem;
  padding: 10px;
  border: 3px solid #000;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--box-shadow-comic-small);
  background-color: #F39C12;
  color: white;
  transition: all 0.1s;
}

.btn-move:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px #000;
}

.btn-move:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-tera {
  grid-column: span 2;
  background-color: #8E44AD;
}

.battle-log-box {
  background-color: #000;
  border: 3px solid #444;
  border-radius: 8px;
  padding: 10px;
  color: #FFF;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.4;
  font-weight: 600;
}

/* Flashing damage hit overlay class */
.flash-red {
  animation: flashRedKey 0.15s ease-out 2;
}

@keyframes flashRedKey {
  0%, 100% { background-color: transparent; }
  50% { background-color: rgba(255, 0, 0, 0.4); }
}

/* Battle Overlay Full Screen Element Flashes */
.battle-overlay.flash-grass { animation: flashGrassKey 0.25s ease-out; }
.battle-overlay.flash-fire { animation: flashFireKey 0.25s ease-out; }
.battle-overlay.flash-water { animation: flashWaterKey 0.25s ease-out; }
.battle-overlay.flash-electric { animation: flashElectricKey 0.25s ease-out; }
.battle-overlay.flash-ground { animation: flashGroundKey 0.25s ease-out; }
.battle-overlay.flash-rock { animation: flashGroundKey 0.25s ease-out; }
.battle-overlay.flash-fairy { animation: flashFairyKey 0.25s ease-out; }
.battle-overlay.flash-steel { animation: flashSteelKey 0.25s ease-out; }
.battle-overlay.flash-poison { animation: flashPoisonKey 0.25s ease-out; }
.battle-overlay.flash-ghost { animation: flashPoisonKey 0.25s ease-out; }
.battle-overlay.flash-bug { animation: flashGrassKey 0.25s ease-out; }
.battle-overlay.flash-normal { animation: flashNormalKey 0.25s ease-out; }
.battle-overlay.flash-fighting { animation: flashNormalKey 0.25s ease-out; }
.battle-overlay.flash-dark { animation: flashNormalKey 0.25s ease-out; }
.battle-overlay.flash-dragon { animation: flashNormalKey 0.25s ease-out; }

@keyframes flashGrassKey {
  0%, 100% { background-color: rgba(0, 0, 0, 0.85); }
  50% { background-color: rgba(46, 204, 113, 0.5); }
}
@keyframes flashFireKey {
  0%, 100% { background-color: rgba(0, 0, 0, 0.85); }
  50% { background-color: rgba(231, 76, 60, 0.5); }
}
@keyframes flashWaterKey {
  0%, 100% { background-color: rgba(0, 0, 0, 0.85); }
  50% { background-color: rgba(52, 152, 219, 0.5); }
}
@keyframes flashElectricKey {
  0%, 100% { background-color: rgba(0, 0, 0, 0.85); }
  50% { background-color: rgba(241, 196, 15, 0.55); }
}
@keyframes flashGroundKey {
  0%, 100% { background-color: rgba(0, 0, 0, 0.85); }
  50% { background-color: rgba(211, 84, 0, 0.5); }
}
@keyframes flashFairyKey {
  0%, 100% { background-color: rgba(0, 0, 0, 0.85); }
  50% { background-color: rgba(255, 105, 180, 0.55); }
}
@keyframes flashSteelKey {
  0%, 100% { background-color: rgba(0, 0, 0, 0.85); }
  50% { background-color: rgba(189, 195, 199, 0.5); }
}
@keyframes flashPoisonKey {
  0%, 100% { background-color: rgba(0, 0, 0, 0.85); }
  50% { background-color: rgba(155, 89, 182, 0.5); }
}
@keyframes flashNormalKey {
  0%, 100% { background-color: rgba(0, 0, 0, 0.85); }
  50% { background-color: rgba(255, 255, 255, 0.5); }
}

/* Battle Card Strike Lunges */
.strike-player {
  animation: strikePlayer 0.35s ease-out;
}
.strike-enemy {
  animation: strikeEnemy 0.35s ease-out;
}

@keyframes strikePlayer {
  0% { transform: translateX(0); }
  35% { transform: translateX(70px) scale(1.06) rotate(3deg); }
  100% { transform: translateX(0); }
}
@keyframes strikeEnemy {
  0% { transform: translateX(0); }
  35% { transform: translateX(-70px) scale(1.06) rotate(-3deg); }
  100% { transform: translateX(0); }
}

/* Card Hit Flash Glows */
.battle-sprite-container.hit-grass { animation: hitGrassKey 0.4s ease; }
.battle-sprite-container.hit-fire { animation: hitFireKey 0.4s ease; }
.battle-sprite-container.hit-water { animation: hitWaterKey 0.4s ease; }
.battle-sprite-container.hit-electric { animation: hitElectricKey 0.4s ease; }
.battle-sprite-container.hit-ground { animation: hitGroundKey 0.4s ease; }
.battle-sprite-container.hit-rock { animation: hitGroundKey 0.4s ease; }
.battle-sprite-container.hit-fairy { animation: hitFairyKey 0.4s ease; }
.battle-sprite-container.hit-steel { animation: hitSteelKey 0.4s ease; }
.battle-sprite-container.hit-poison { animation: hitPoisonKey 0.4s ease; }
.battle-sprite-container.hit-ghost { animation: hitPoisonKey 0.4s ease; }
.battle-sprite-container.hit-bug { animation: hitGrassKey 0.4s ease; }
.battle-sprite-container.hit-normal { animation: hitNormalKey 0.4s ease; }
.battle-sprite-container.hit-fighting { animation: hitNormalKey 0.4s ease; }
.battle-sprite-container.hit-dark { animation: hitNormalKey 0.4s ease; }
.battle-sprite-container.hit-dragon { animation: hitNormalKey 0.4s ease; }

@keyframes hitGrassKey {
  0%, 100% { box-shadow: var(--box-shadow-comic); }
  50% { box-shadow: 0 0 30px #2ECC71; background-color: rgba(46, 204, 113, 0.35); }
}
@keyframes hitFireKey {
  0%, 100% { box-shadow: var(--box-shadow-comic); }
  50% { box-shadow: 0 0 30px #E74C3C; background-color: rgba(231, 76, 60, 0.35); }
}
@keyframes hitWaterKey {
  0%, 100% { box-shadow: var(--box-shadow-comic); }
  50% { box-shadow: 0 0 30px #3498DB; background-color: rgba(52, 152, 219, 0.35); }
}
@keyframes hitElectricKey {
  0%, 100% { box-shadow: var(--box-shadow-comic); }
  50% { box-shadow: 0 0 30px #F1C40F; background-color: rgba(241, 196, 15, 0.35); }
}
@keyframes hitGroundKey {
  0%, 100% { box-shadow: var(--box-shadow-comic); }
  50% { box-shadow: 0 0 30px #D35400; background-color: rgba(211, 84, 0, 0.35); }
}
@keyframes hitFairyKey {
  0%, 100% { box-shadow: var(--box-shadow-comic); }
  50% { box-shadow: 0 0 30px #FF69B4; background-color: rgba(255, 105, 180, 0.35); }
}
@keyframes hitSteelKey {
  0%, 100% { box-shadow: var(--box-shadow-comic); }
  50% { box-shadow: 0 0 30px #BDC3C7; background-color: rgba(189, 195, 199, 0.35); }
}
@keyframes hitPoisonKey {
  0%, 100% { box-shadow: var(--box-shadow-comic); }
  50% { box-shadow: 0 0 30px #9B59B6; background-color: rgba(155, 89, 182, 0.35); }
}
@keyframes hitNormalKey {
  0%, 100% { box-shadow: var(--box-shadow-comic); }
  50% { box-shadow: 0 0 30px #FFF; background-color: rgba(255, 255, 255, 0.35); }
}

/* Combat Particles overlay inside container */
.attack-particle-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.damage-number-pop {
  position: absolute;
  left: 50%;
  top: 16%;
  z-index: 8;
  transform: translate(-50%, 0);
  padding: 4px 10px;
  border: 3px solid #000;
  border-radius: 10px;
  background: #E74C3C;
  color: #FFF;
  font-family: var(--font-title);
  font-size: 1.1rem;
  text-shadow: 1px 1px 0 #000;
  box-shadow: 3px 3px 0 #000;
  pointer-events: none;
  animation: damageNumberRise 1.05s ease-out forwards;
}

@keyframes damageNumberRise {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.75); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -44px) scale(0.9); }
}

.combat-particle {
  position: absolute;
  background-color: var(--particle-color, #FFF);
  border-radius: 50%;
  border: 2px solid #000;
  box-shadow: 1.5px 1.5px 0px #000;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  animation: explodeParticle 0.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes explodeParticle {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.2);
    opacity: 0;
  }
}

/* Particle Shape Variants */
.combat-particle.element-grass {
  border-radius: 0 80% 0 80%;
  transform: translate(-50%, -50%) rotate(45deg);
}
.combat-particle.element-fire {
  border-radius: 50% 50% 50% 0%;
  transform: translate(-50%, -50%) rotate(-45deg);
}
.combat-particle.element-water {
  border-radius: 0% 50% 50% 50%;
  transform: translate(-50%, -50%) rotate(135deg);
}
.combat-particle.element-electric {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.combat-particle.element-fairy {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* Comic word bubble pops for battles */
.action-popup {
  position: absolute;
  z-index: 10;
  font-family: var(--font-title);
  font-size: 2.2rem;
  color: var(--accent-yellow);
  text-shadow: 2px 2px 0px #C0392B, 4px 4px 0px #000;
  text-transform: uppercase;
  transform: rotate(-10deg) scale(0);
  animation: popWord 0.8s forwards ease-out;
}

@keyframes popWord {
  0% { transform: rotate(-25deg) scale(0); opacity: 0; }
  30% { transform: rotate(-10deg) scale(1.3); opacity: 1; }
  60% { transform: rotate(-10deg) scale(1); opacity: 1; }
  100% { transform: rotate(-5deg) scale(0.9); opacity: 0; }
}


/* --- Property Cards Detail Overlay --- */
.card-detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 60;
  display: none;
  justify-content: center;
  align-items: center;
}

.deed-card {
  background-color: #FFF;
  border: 4px solid #000;
  border-radius: 12px;
  width: 320px;
  padding: 15px;
  color: var(--text-dark);
  box-shadow: 8px 8px 0px #000;
  text-align: center;
}

.save-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.72);
  z-index: 75;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.save-modal {
  background: #FFF;
  color: var(--text-dark);
  border: 4px solid #000;
  border-radius: 12px;
  box-shadow: 8px 8px 0 #000;
  width: min(760px, 96vw);
  padding: 16px;
}

.save-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.save-modal-title {
  font-family: var(--font-title);
  color: var(--accent-blue);
  font-size: 1.55rem;
  text-shadow: 1.5px 1.5px 0 #000;
}

.save-close-btn {
  width: 34px;
  height: 34px;
  border: 2px solid #000;
  border-radius: 50%;
  background: var(--accent-red);
  color: #FFF;
  font-size: 1.2rem;
  font-weight: 900;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
}

.save-slots-grid-modal {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.deed-header {
  border: 3px solid #000;
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 8px;
  color: white;
  font-family: var(--font-title);
  font-size: 1.4rem;
}

.deed-header.brown { background-color: var(--group-brown); }
.deed-header.light-blue { background-color: var(--group-light-blue); }
.deed-header.pink { background-color: var(--group-pink); }
.deed-header.orange { background-color: var(--group-orange); }
.deed-header.red { background-color: var(--group-red); }
.deed-header.yellow { background-color: var(--group-yellow); }
.deed-header.green { background-color: var(--group-green); }
.deed-header.dark-blue { background-color: var(--group-dark-blue); }
.deed-header.station { background-color: #34495E; }
.deed-header.utility { background-color: #F39C12; }

.deed-pokemon-name {
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.deed-info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.deed-info-row.bold {
  font-weight: 800;
  font-size: 0.95rem;
  border-top: 1px solid #CCC;
  padding-top: 6px;
  margin-top: 6px;
}

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

/* Card Draw overlays */
.card-draw-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 70;
  display: none;
  justify-content: center;
  align-items: center;
}

.drawn-card-box {
  background-color: var(--accent-yellow);
  border: 4px solid #000;
  border-radius: 16px;
  width: 380px;
  padding: 25px;
  color: var(--text-dark);
  box-shadow: 10px 10px 0px #000;
  text-align: center;
  transform: rotate(-3deg);
  position: relative;
}

.drawn-card-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--accent-blue);
  text-shadow: 2px 2px 0px #FFF, 3.5px 3.5px 0px #000;
  margin-bottom: 15px;
}

.drawn-card-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.4;
}

/* Terastal Star animation overlay */
.tera-gem-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

/* --- Catch Mini-game Styles --- */
.catch-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 80;
  display: none;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.catch-container {
  background-color: #FFF;
  border: 4px solid #000;
  border-radius: 16px;
  width: 420px;
  padding: 20px;
  color: var(--text-dark);
  box-shadow: 10px 10px 0px #000;
  text-align: center;
  position: relative;
}

.catch-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  letter-spacing: 1px;
  color: var(--accent-yellow);
  text-shadow: 2px 2px 0px var(--accent-blue), 4px 4px 0px #000;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.catch-subtitle {
  font-size: 0.85rem;
  font-weight: 800;
  color: #7F8C8D;
  margin-bottom: 20px;
}

.catch-arena {
  width: 300px;
  height: 300px;
  background-color: #ECEFF1;
  border: 3px solid #000;
  border-radius: 12px;
  margin: 0 auto 20px auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-shadow: inset 0px 0px 15px rgba(0,0,0,0.1);
  background-image: radial-gradient(#CFD8DC 15%, transparent 16%);
  background-size: 14px 14px;
  cursor: pointer;
}

.catch-sprite-container {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #000;
  background-color: #FFF;
  z-index: 9;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.catch-sprite-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.35);
  filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.25));
}

.catch-sprite-container svg {
  width: 100%;
  height: 100%;
  transform: scale(1.35);
  filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.25));
}

/* Sizing Timing Rings */
.catch-ring-outer {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 3px dashed rgba(0, 0, 0, 0.45);
  border-radius: 50%;
  pointer-events: none;
  z-index: 11;
}

.catch-ring-inner {
  position: absolute;
  border: 4px solid #2ECC71; /* Defaults to Green */
  border-radius: 50%;
  pointer-events: none;
  z-index: 12;
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
  width: 100%;
  height: 100%;
  max-width: 200px;
  max-height: 200px;
}

/* Static Target sweet spot rings */
.catch-guide {
  position: absolute;
  border: 2px dashed rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  pointer-events: none;
  z-index: 13;
}
.catch-guide.nice {
  width: 136px;
  height: 136px;
  border-color: rgba(241, 196, 15, 0.65); /* Yellow Nice */
}
.catch-guide.great {
  width: 96px;
  height: 96px;
  border-color: rgba(52, 152, 219, 0.75); /* Blue Great */
}
.catch-guide.excellent {
  width: 60px;
  height: 60px;
  border-color: rgba(155, 89, 182, 0.85); /* Purple Excellent */
}
.catch-legend {
  margin: 12px 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: #7F8C8D;
  text-align: center;
}

/* Ball selection panel */
.ball-selection {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  gap: 8px;
}

.btn-ball {
  flex: 1;
  background-color: #F8F9F9;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  box-shadow: var(--box-shadow-comic-small);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.1s;
}

.btn-ball:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0px #000;
}

.btn-ball.active {
  background-color: var(--accent-yellow);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px #000;
}

.ball-label {
  font-size: 0.75rem;
  font-weight: 800;
  margin-top: 5px;
  color: var(--text-dark);
  line-height: 1.2;
}

.ball-label small {
  color: #27AE60;
  font-weight: 800;
}

/* Sizing Ball CSS Icons */
.ball-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid #000;
  position: relative;
  overflow: hidden;
  box-shadow: 2px 2px 0px #000;
  display: inline-block;
}

/* Center Horizontal Band */
.ball-icon::before {
  content: "";
  position: absolute;
  top: calc(50% - 1.25px);
  left: 0;
  width: 100%;
  height: 2.5px;
  background-color: #000;
  z-index: 9;
}

/* Center Button Circle */
.ball-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background-color: #FFF;
  border: 2.5px solid #000;
  border-radius: 50%;
  z-index: 12;
}

/* Poke Ball Styles (Red) */
.ball-icon.poke {
  background: linear-gradient(to bottom, #E74C3C 50%, #FFF 50%);
}

/* Great Ball Styles (Blue with Red Stripes) */
.ball-icon.great {
  background: 
    linear-gradient(to right, #E74C3C 20%, transparent 20%, transparent 80%, #E74C3C 80%),
    linear-gradient(to bottom, #3498DB 50%, #FFF 50%);
  background-size: 100% 50%, 100% 100%;
  background-repeat: no-repeat;
}

/* Ultra Ball Styles (Black with Yellow Stripes) */
.ball-icon.ultra {
  background: 
    linear-gradient(to right, #F1C40F 25%, transparent 25%, transparent 75%, #F1C40F 75%),
    linear-gradient(to bottom, #2C3E50 50%, #FFF 50%);
  background-size: 100% 50%, 100% 100%;
  background-repeat: no-repeat;
}

/* Projectile Styles */
.pokeball-projectile {
  width: 40px;
  height: 40px;
  position: absolute;
  bottom: -50px;
  left: calc(50% - 20px);
  z-index: 20;
}

/* Projectile Animation states */
@keyframes throwCurve {
  0% { bottom: -50px; transform: scale(1) rotate(0deg); }
  50% { bottom: 170px; transform: scale(0.7) rotate(360deg); }
  100% { bottom: 130px; transform: scale(0.55) rotate(720deg); }
}

@keyframes dropDown {
  0% { bottom: 130px; transform: scale(0.55); }
  100% { bottom: 35px; transform: scale(0.75); }
}

@keyframes ballWiggleAnim {
  0%, 100% { transform: scale(0.75) rotate(0deg); }
  25% { transform: scale(0.75) rotate(-20deg); }
  75% { transform: scale(0.75) rotate(20deg); }
}

@keyframes catchBurst {
  0% { transform: scale(0.75); box-shadow: 0 0 0px transparent; }
  50% { transform: scale(0.85); box-shadow: 0 0 25px #F1C40F; filter: brightness(2); }
  100% { transform: scale(0.75); box-shadow: 0 0 0px transparent; }
}

.pokeball-projectile.throwing {
  animation: throwCurve 0.5s ease-out forwards;
}

.pokeball-projectile.dropping {
  animation: dropDown 0.3s ease-in forwards;
}

.pokeball-projectile.wiggling {
  animation: ballWiggleAnim 0.4s ease-in-out;
}

.pokeball-projectile.success-burst {
  animation: catchBurst 0.6s ease-out;
}

/* Controls */
.catch-controls {
  margin-top: 10px;
}

.btn-throw {
  width: 100%;
  font-size: 1.4rem;
  background-color: var(--accent-yellow);
  padding: 10px;
}

/* Comic Feedback Word bubble */
.catch-feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-family: var(--font-title);
  font-size: 2.5rem;
  color: var(--accent-yellow);
  text-shadow: 2.5px 2.5px 0px var(--accent-blue), 4.5px 4.5px 0px #000;
  text-transform: uppercase;
  z-index: 30;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.catch-feedback.show {
  transform: translate(-50%, -50%) scale(1.1);
  animation: feedbackPop 0.8s forwards;
}

@keyframes feedbackPop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  35% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}

/* --- Property Ownership Visual Highlighters --- */
.tile.owned-p0 { box-shadow: inset 0 0 0 4.5px #E74C3C !important; }
.tile.owned-p1 { box-shadow: inset 0 0 0 4.5px #F1C40F !important; }
.tile.owned-p2 { box-shadow: inset 0 0 0 4.5px #3498DB !important; }
.tile.owned-p3 { box-shadow: inset 0 0 0 4.5px #8E44AD !important; }

/* Floating cash transaction indicators inside sidebar */
.floating-cash {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 900;
  z-index: 100;
  pointer-events: none;
  text-shadow: 2px 2px 0px #000;
}

.floating-cash.gain {
  color: #2ECC71; /* Vibrant green */
  animation: floatCashGain 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.floating-cash.loss {
  color: #E74C3C; /* Vibrant red */
  animation: floatCashLoss 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes floatCashGain {
  0% { transform: translateY(-50%) scale(0.6); opacity: 0; }
  25% { transform: translateY(-85%) scale(1.15); opacity: 1; }
  100% { transform: translateY(-140%) scale(1); opacity: 0; }
}

@keyframes floatCashLoss {
  0% { transform: translateY(-50%) scale(0.6); opacity: 0; }
  25% { transform: translateY(-15%) scale(1.15); opacity: 1; }
  100% { transform: translateY(40%) scale(1); opacity: 0; }
}

/* Terastallization Visual Effects */
.crystal-flash-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(235,245,251,0.6) 50%, rgba(142,68,173,0.4) 100%);
  mix-blend-mode: color-dodge;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
}
.crystal-flash-overlay.active {
  animation: crystalFlashAnim 1.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes crystalFlashAnim {
  0% { opacity: 0; backdrop-filter: brightness(2) blur(0px); }
  15% { opacity: 1; backdrop-filter: brightness(3) blur(8px); background-color: rgba(255, 255, 255, 0.95); }
  100% { opacity: 0; backdrop-filter: brightness(1) blur(0px); }
}

.screenshake-active {
  animation: screenshakeAnim 0.8s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes screenshakeAnim {
  10%, 90% { transform: translate3d(-3px, 3px, 0) rotate(-1.5deg); }
  20%, 80% { transform: translate3d(4px, -4px, 0) rotate(2deg); }
  30%, 50%, 70% { transform: translate3d(-8px, 8px, 0) rotate(-2.5deg); }
  40%, 60% { transform: translate3d(7px, -7px, 0) rotate(3deg); }
}

/* Crystal Shimmer Border for Terastallized Pokemon sprite wrapper */
.battle-sprite-container.tera-active {
  animation: teraGlow 1.5s ease-in-out infinite alternate;
  position: relative;
  overflow: visible !important;
}

.battle-sprite-container.tera-active::before {
  content: "";
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  border: 4px dashed #FFF;
  border-radius: 16px;
  animation: rotateBorder 8s linear infinite;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 15px #FFF, inset 0 0 10px #FFF;
}

.battle-sprite-container.tera-active img {
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.9)) saturate(1.3) contrast(1.15);
  animation: floatTera 3s ease-in-out infinite;
}

@keyframes teraGlow {
  0% {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4),
                0 0 25px rgba(142, 68, 173, 0.3),
                0 0 35px rgba(52, 152, 219, 0.2);
  }
  100% {
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.8),
                0 0 45px rgba(142, 68, 173, 0.6),
                0 0 65px rgba(52, 152, 219, 0.5);
  }
}

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

@keyframes floatTera {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

/* --- Catch Mini-game Layout Panel --- */
.catch-minigame-panel {
  width: 100%;
  margin: 10px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 85px; /* Keeps container layout stable */
}

/* --- Sliding Bar Mini-game Styles (Horizontal) --- */
.catch-bar-container {
  position: relative;
  width: 260px;
  height: 30px;
  margin: 0 auto;
  z-index: 15;
  pointer-events: none;
}

.catch-bar-track {
  position: relative;
  width: 100%;
  height: 16px;
  background-color: rgba(0, 0, 0, 0.4);
  border: 3px solid #000;
  border-radius: 8px;
  top: 7px;
}

.catch-bar-sweetspot {
  position: absolute;
  height: 100%;
  background-color: rgba(46, 204, 113, 0.75);
  border-left: 2px dashed #000;
  border-right: 2px dashed #000;
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.8);
  pointer-events: none;
}

.catch-bar-indicator {
  position: absolute;
  top: -5px;
  width: 8px;
  height: 20px;
  background-color: #E74C3C;
  border: 2px solid #000;
  border-radius: 3px;
  box-shadow: 0 0 8px #E74C3C;
  pointer-events: none;
  transition: left 0.016s linear; /* Smooth micro-interpolation */
}

/* --- Power Spam Mini-game Styles --- */
.catch-spam-container {
  width: 100%;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.catch-spam-prompt {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: #E74C3C;
  text-shadow: 1px 1px 0px #000, -1px -1px 0px #000;
  animation: pulseSpam 0.6s infinite alternate;
  pointer-events: none;
}

.catch-spam-bar {
  width: 80%;
  height: 16px;
  border: 3px solid #000;
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
  pointer-events: none;
}

.catch-spam-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #F1C40F, #E67E22, #E74C3C);
  box-shadow: 0 0 8px rgba(230, 126, 34, 0.8);
  transition: width 0.05s ease-out;
}

.catch-spam-timer {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 800;
  color: #000;
  background-color: rgba(255, 255, 255, 0.85);
  padding: 2px 8px;
  border: 2px solid #000;
  border-radius: 4px;
  pointer-events: none;
}

/* --- QTE Arrow Sequence Mini-game Styles --- */
.catch-qte-container {
  width: 100%;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.catch-qte-sequence {
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.qte-arrow-node {
  width: 28px;
  height: 28px;
  border: 2px solid #000;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #FFF;
  font-size: 0.9rem;
  font-weight: bold;
  box-shadow: 2px 2px 0px #000;
  transition: all 0.1s ease;
  pointer-events: none;
}

.qte-arrow-node.current {
  background-color: #F1C40F;
  animation: pulseSpam 0.4s infinite alternate;
}

.qte-arrow-node.success {
  background-color: #2ECC71;
  color: #FFF;
  transform: scale(1.1);
  box-shadow: 0 0 6px #2ECC71;
}

.qte-arrow-node.error {
  background-color: #E74C3C;
  color: #FFF;
  animation: shakeQte 0.2s 2;
}

.catch-qte-keys {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto; /* Allow clicking the keys */
}

.qte-row {
  display: flex;
  gap: 4px;
}

.btn-qte-arrow {
  width: 32px;
  height: 32px;
  border: 2px solid #000;
  border-radius: 6px;
  background-color: #ECF0F1;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 2px 2px 0px #000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: active 0.05s;
}

.btn-qte-arrow:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #000;
  background-color: #BDC3C7;
}

.catch-qte-timer {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 800;
  color: #000;
  background-color: rgba(255, 255, 255, 0.85);
  padding: 2px 8px;
  border: 2px solid #000;
  border-radius: 4px;
  pointer-events: none;
}

/* Animations */
@keyframes pulseSpam {
  0% { transform: scale(0.95); }
  100% { transform: scale(1.08); }
}

@keyframes shakeQte {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

/* Pokemon Selection Modal Overlay */
.pokemon-selection-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 80; /* Higher than card draw overlay which is z-index 70 */
  display: none;
  justify-content: center;
  align-items: center;
}

.pokemon-selection-box {
  background-color: var(--card-bg, #2C3E50);
  border: 4px solid #000;
  border-radius: 20px;
  width: 500px;
  max-width: 90vw;
  max-height: 85vh;
  padding: 25px;
  color: #FFF;
  box-shadow: 10px 10px 0px #000;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.pokemon-selection-title {
  font-family: var(--font-title);
  font-size: 2rem;
  color: var(--accent-yellow);
  text-shadow: 2px 2px 0px #000, 4px 4px 0px rgba(0,0,0,0.15);
  margin-bottom: 10px;
  text-align: center;
  letter-spacing: 1px;
}

.pokemon-selection-subtitle {
  font-size: 0.95rem;
  color: #BDC3C7;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 500;
}

.pokemon-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 15px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 5px;
  margin-bottom: 18px;
}

.pokemon-selection-footer {
  flex: 0 0 auto;
  padding-top: 2px;
}

.pokemon-selection-grid::-webkit-scrollbar {
  width: 8px;
}
.pokemon-selection-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}
.pokemon-selection-grid::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 4px;
  border: 1px solid #000;
}

.fighter-card {
  background-color: #34495E;
  border: 3px solid #000;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
  box-shadow: 3.5px 3.5px 0px #000;
}

.fighter-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 5px 5px 0px #000;
  background-color: #3D566E;
}

.fighter-card.selected {
  background-color: #16A085;
  border-color: var(--accent-yellow);
  box-shadow: 4px 4px 0px var(--accent-yellow);
}

.fighter-card .fighter-sprite {
  width: 75px;
  height: 75px;
  background: #F8F9F9;
  border: 3px solid #000;
  border-radius: 12px;
  box-shadow: 4px 4px 0 #000;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
  overflow: hidden;
}

.fighter-card .fighter-sprite img {
  width: 175%;
  height: 175%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
  filter: drop-shadow(3px 5px 0 rgba(0, 0, 0, 0.45));
}

.fighter-card .fighter-sprite svg {
  width: 95%;
  height: 95%;
  filter: drop-shadow(3px 5px 0 rgba(0, 0, 0, 0.45));
}

.fighter-card .fighter-name {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: bold;
  text-align: center;
  color: #FFF;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.fighter-card .fighter-type {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid #000;
  color: #FFF;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 0px #000;
}

.fighter-card .fighter-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background-color: var(--accent-red);
  color: white;
  border: 2px solid #000;
  font-size: 0.6rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 6px;
  box-shadow: 1px 1px 0px #000;
}

.fighter-card .fighter-level-badge {
  position: absolute;
  top: -7px;
  left: -7px;
  background-color: var(--accent-yellow);
  color: #000;
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  font-family: var(--font-title);
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 8px;
  z-index: 2;
}

/* --- Level-up Modal Styles --- */
.pokemon-levelup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 90;
  display: none;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.levelup-box {
  background-color: #FFF;
  border: 4px solid #000;
  border-radius: 16px;
  width: 550px;
  max-height: 90vh;
  padding: 24px;
  color: var(--text-dark);
  box-shadow: 10px 10px 0px #000;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.levelup-title {
  font-family: var(--font-title);
  font-size: 2.5rem;
  letter-spacing: 1px;
  color: var(--accent-yellow);
  text-shadow: 2px 2px 0px var(--accent-blue), 4px 4px 0px #000;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.levelup-subtitle {
  font-size: 0.95rem;
  font-weight: 800;
  color: #7F8C8D;
  margin-bottom: 20px;
}

.levelup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  overflow-y: auto;
  padding: 10px;
  margin-bottom: 20px;
  flex: 1;
}

.levelup-card {
  position: relative;
  background-color: #F8F9F9;
  border: 3px solid #000;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--box-shadow-comic-small);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.15s ease;
}

.levelup-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px #000;
}

.levelup-card.selected {
  background-color: #FFF9C4;
  border-color: var(--accent-yellow);
  transform: translate(-3px, -3px);
  box-shadow: 7px 7px 0px #000;
}

.levelup-card .levelup-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  background-color: var(--accent-blue);
  color: white;
  border: 2px solid #000;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 6px;
  box-shadow: 1px 1px 0px #000;
}

.levelup-sprite {
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
}

.levelup-sprite img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.levelup-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.levelup-level {
  font-size: 0.85rem;
  font-weight: 800;
  color: #7F8C8D;
  margin-bottom: 10px;
}

.levelup-stats {
  width: 100%;
  background-color: #ECEFF1;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 8px;
  font-size: 0.75rem;
  font-weight: bold;
  text-align: left;
  line-height: 1.4;
}

.levelup-stat-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.levelup-stat-change {
  color: #27AE60;
  font-weight: 800;
}

.levelup-confirm-btn {
  background-color: var(--accent-red);
  color: white;
  min-width: 200px;
  font-size: 1.2rem;
  padding: 12px 24px;
}

@media (max-width: 760px) {
  .setup-box {
    padding: 20px;
  }

  .save-slots-grid,
  .save-slots-grid-modal {
    grid-template-columns: 1fr;
  }

  .save-slot-card {
    min-height: 128px;
  }
}
