/* ============================================================
   KUMONSTER — Dark-Themed Browser Roguelike Monster Autobattler
   Complete Stylesheet
   ============================================================ */

/* ----- CSS Custom Properties ----- */
:root {
  --color-bg: #0f0f1a;
  --color-bg-alt: #1a1a2e;
  --color-bg-card: #232342;
  --color-text: #e0e0ff;
  --color-primary: #00e5ff;
  --color-glow: #ff6fff;
  --color-wild: #66bb6a;
  --color-trainer: #ef5350;
  --color-shop: #ffa726;
  --color-heal: #ec407a;
  --color-trade: #42a5f5;
  --color-event: #ab47bc;
  --color-gym: #e91e63;
  --transition-fast: 0.2s;
  --transition-medium: 0.4s;
  --sidebar-width: 260px;
}

/* ----- Keyframe Animations ----- */

@keyframes glow {
  0%, 100% { text-shadow: 0 0 8px var(--color-primary), 0 0 20px var(--color-primary); }
  50%      { text-shadow: 0 0 18px var(--color-primary), 0 0 40px var(--color-glow); }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%      { transform: translateX(-8px); }
  20%      { transform: translateX(8px); }
  30%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  50%      { transform: translateX(-4px); }
  60%      { transform: translateX(4px); }
  70%      { transform: translateX(-2px); }
  80%      { transform: translateX(2px); }
}

@keyframes hitFlash {
  0%   { background-color: transparent; }
  20%  { background-color: rgba(255,255,255,0.6); }
  100% { background-color: transparent; }
}

@keyframes floatUp {
  0%   { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-40px); opacity: 0; }
}

@keyframes fadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideIn {
  0%   { transform: translateX(100%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes slideUp {
  0%   { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes scaleIn {
  0%   { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes redPulse {
  0%, 100% { background-color: var(--color-bg); }
  50%      { background-color: #2a0a0a; }
}

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

@keyframes moveAppear {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes nodePulse {
  0%, 100% { box-shadow: 0 0 6px 2px currentColor; }
  50%      { box-shadow: 0 0 16px 6px currentColor; }
}

@keyframes hpFlash {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.5); }
}

@keyframes slideDown {
  0%   { transform: translateY(-20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ----- Reset & Base ----- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

select, input {
  font-family: inherit;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--color-bg-card);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* ----- Utility Classes ----- */

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-glow { animation: glow 2s ease-in-out infinite; }
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   1. TITLE SCREEN
   ============================================================ */

#title-screen,
.title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 25%, #1e0a2e 50%, #0f0f1a 75%, #0a1a2e 100%);
  background-size: 400% 400%;
  animation: gradientBg 12s ease infinite;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.title-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(0,229,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.game-title,
#title-screen h1 {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--color-primary);
  text-shadow:
    0 0 10px var(--color-primary),
    0 0 30px var(--color-primary),
    0 0 60px rgba(0,229,255,0.4);
  animation: glow 3s ease-in-out infinite;
  margin-bottom: 0.5rem;
  user-select: none;
}

.game-subtitle,
#title-screen .subtitle {
  font-size: 1.15rem;
  color: rgba(224,224,255,0.6);
  margin-bottom: 2.5rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.title-menu,
#title-screen .menu {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 320px;
}

.title-menu button,
.title-screen button,
#title-screen .menu button {
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 8px;
  background: var(--color-bg-card);
  color: var(--color-text);
  border: 1px solid rgba(0,229,255,0.2);
  transition: all var(--transition-fast) ease;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.title-menu button:hover,
.title-screen button:hover,
#title-screen .menu button:hover {
  background: rgba(0,229,255,0.12);
  border-color: var(--color-primary);
  box-shadow: 0 0 16px rgba(0,229,255,0.2);
  transform: translateY(-2px);
}

.title-menu button:active,
.title-screen button:active {
  transform: translateY(0);
}

.title-menu button.primary,
.title-screen button.primary {
  background: linear-gradient(135deg, var(--color-primary), #0097a7);
  color: #0f0f1a;
  border-color: transparent;
  font-weight: 700;
}

.title-menu button.primary:hover {
  box-shadow: 0 0 24px rgba(0,229,255,0.4);
}

/* ============================================================
   2. GAME LAYOUT (main wrapper)
   ============================================================ */

#game-container,
.game-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.main-content,
#main-content {
  flex: 1;
  padding: 1rem;
  padding-bottom: 60px; /* space for nav bar */
  margin-right: var(--sidebar-width);
  overflow-y: auto;
  max-height: 100vh;
}

/* ============================================================
   3. MAP SCREEN (Slay the Spire)
   ============================================================ */

#map-screen,
.map-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  gap: 0;
  position: relative;
  min-height: 100%;
}

.map-title {
  font-size: 1.3rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.map-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
  width: 100%;
  max-width: 600px;
}

/* SVG connections layer */
.map-connections,
.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.map-connections line,
.map-svg line {
  stroke: rgba(224,224,255,0.12);
  stroke-width: 2;
  stroke-linecap: round;
}

.map-connections line.active,
.map-svg line.active {
  stroke: rgba(0,229,255,0.35);
  stroke-width: 2.5;
}

.map-connections line.visited,
.map-svg line.visited {
  stroke: rgba(0,229,255,0.15);
  stroke-dasharray: 4 4;
}

/* Map layer = one row of nodes */
.map-layer,
.map-row {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.6rem 0;
  position: relative;
  z-index: 1;
  width: 100%;
}

.map-layer-label {
  font-size: 0.65rem;
  color: rgba(224,224,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Map node */
.map-node {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--transition-fast) ease;
  position: relative;
  background: var(--color-bg-card);
  user-select: none;
  flex-shrink: 0;
}

.map-node .node-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.map-node .node-label {
  position: absolute;
  bottom: -18px;
  font-size: 0.55rem;
  color: rgba(224,224,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Node type colors */
.map-node.wild,
.map-node[data-type="wild"]       { border-color: var(--color-wild); color: var(--color-wild); }
.map-node.trainer,
.map-node[data-type="trainer"]    { border-color: var(--color-trainer); color: var(--color-trainer); }
.map-node.shop,
.map-node[data-type="shop"]       { border-color: var(--color-shop); color: var(--color-shop); }
.map-node.heal,
.map-node[data-type="heal"]       { border-color: var(--color-heal); color: var(--color-heal); }
.map-node.trade,
.map-node[data-type="trade"]      { border-color: var(--color-trade); color: var(--color-trade); }
.map-node.event,
.map-node[data-type="event"]      { border-color: var(--color-event); color: var(--color-event); }
.map-node.gym,
.map-node[data-type="gym"] {
  border-image: linear-gradient(135deg, var(--color-gym), var(--color-glow)) 1;
  border-width: 3px;
  border-style: solid;
  border-radius: 50%;
  color: var(--color-gym);
  background: linear-gradient(135deg, rgba(233,30,99,0.1), rgba(255,111,255,0.1));
}
.map-node.start,
.map-node[data-type="start"]     { border-color: var(--color-primary); color: var(--color-primary); }
.map-node.boss,
.map-node[data-type="boss"] {
  border-color: var(--color-gym);
  color: var(--color-gym);
  box-shadow: 0 0 12px rgba(233,30,99,0.3);
}

/* Node states */
.map-node.available {
  animation: nodePulse 2s ease-in-out infinite;
}

.map-node.visited {
  opacity: 0.3;
  cursor: default;
  filter: saturate(0.4);
}

.map-node.unreachable {
  opacity: 0.15;
  cursor: default;
  pointer-events: none;
}

.map-node.current {
  box-shadow: 0 0 12px 4px var(--color-primary);
  border-color: var(--color-primary);
}

.map-node.available:hover {
  transform: scale(1.15);
  filter: brightness(1.2);
  z-index: 10;
}

.map-node.available.wild:hover       { box-shadow: 0 0 20px rgba(102,187,106,0.5); }
.map-node.available.trainer:hover    { box-shadow: 0 0 20px rgba(239,83,80,0.5); }
.map-node.available.shop:hover       { box-shadow: 0 0 20px rgba(255,167,38,0.5); }
.map-node.available.heal:hover       { box-shadow: 0 0 20px rgba(236,64,122,0.5); }
.map-node.available.trade:hover      { box-shadow: 0 0 20px rgba(66,165,245,0.5); }
.map-node.available.event:hover      { box-shadow: 0 0 20px rgba(171,71,188,0.5); }
.map-node.available.gym:hover        { box-shadow: 0 0 20px rgba(233,30,99,0.5); }

/* ============================================================
   4. BATTLE SCREEN
   ============================================================ */

#battle-screen,
.battle-screen {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  animation: fadeIn 0.4s ease;
}

.battle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

.battle-header h2 {
  font-size: 1.1rem;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.battle-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Battle speed selector */
.battle-speed-select,
.speed-select {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  background: var(--color-bg-card);
  color: var(--color-text);
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 4px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 1.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2300e5ff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.battle-speed-select:hover,
.speed-select:hover {
  border-color: var(--color-primary);
}

/* Skip button */
.btn-skip,
.skip-btn {
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--color-bg-card);
  color: var(--color-text);
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all var(--transition-fast) ease;
}

.btn-skip:hover,
.skip-btn:hover {
  background: rgba(0,229,255,0.12);
  border-color: var(--color-primary);
}

/* Battle arena */
.battle-arena {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 200px;
}

.battle-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}

.battle-side.player {
  align-items: flex-start;
}

.battle-side.enemy {
  align-items: flex-end;
}

/* VS Divider */
.battle-vs,
.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  font-size: 1.4rem;
  font-weight: 900;
  color: rgba(224,224,255,0.15);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  user-select: none;
  flex-shrink: 0;
  position: relative;
}

.battle-vs::before,
.vs-divider::before {
  content: '';
  position: absolute;
  width: 2px;
  top: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent, rgba(224,224,255,0.1), transparent);
}

/* Monster Card */
.monster-card {
  background: var(--color-bg-card);
  border: 2px solid rgba(224,224,255,0.08);
  border-radius: 12px;
  padding: 1rem;
  width: 100%;
  max-width: 320px;
  transition: all var(--transition-fast) ease;
  position: relative;
  overflow: hidden;
}

.monster-card.active {
  min-height: 120px;
  border-color: var(--color-primary);
  box-shadow:
    0 0 12px rgba(0,229,255,0.15),
    inset 0 0 30px rgba(0,229,255,0.03);
}

.monster-card .monster-sprite {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.4rem;
  display: block;
  text-align: center;
}

.monster-card .monster-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.monster-card .monster-level {
  font-size: 0.7rem;
  color: rgba(224,224,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}

/* Type badges */
.type-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.25rem;
  margin-bottom: 0.35rem;
  background: rgba(224,224,255,0.08);
  color: var(--color-text);
}

.type-badge.type-Fire    { background: rgba(239,83,80,0.25); color: #ff6b6b; }
.type-badge.type-Water   { background: rgba(66,165,245,0.25); color: #64b5f6; }
.type-badge.type-Nature  { background: rgba(102,187,106,0.25); color: #81c784; }
.type-badge.type-Light   { background: rgba(255,213,79,0.25); color: #ffd54f; }
.type-badge.type-Shadow  { background: rgba(103,58,183,0.25); color: #b39ddb; }
.type-badge.type-Neutral { background: rgba(189,189,189,0.2); color: #bdbdbd; }
.type-badge.type-Chaos  { background: rgba(63,81,181,0.25); color: #9fa8da; }

/* HP Bar */
.hp-bar-container {
  width: 100%;
  margin-top: 0.4rem;
}

.hp-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: rgba(224,224,255,0.5);
  margin-bottom: 2px;
}

.hp-bar-label-text {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hp-bar-numbers {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.hp-bar {
  width: 100%;
  height: 10px;
  background: rgba(0,0,0,0.4);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.hp-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width var(--transition-medium) ease, background-color var(--transition-medium) ease;
  position: relative;
}

/* HP color thresholds */
.hp-bar-fill.hp-high,
.hp-bar-fill[data-hp="high"]   { background: linear-gradient(90deg, #43a047, #66bb6a); }
.hp-bar-fill.hp-mid,
.hp-bar-fill[data-hp="mid"]    { background: linear-gradient(90deg, #f9a825, #fdd835); }
.hp-bar-fill.hp-low,
.hp-bar-fill[data-hp="low"]    { background: linear-gradient(90deg, #c62828, #ef5350); }

/* Fallback: auto-color via style or percentage */
.hp-bar-fill {
  background: linear-gradient(90deg, #43a047, #66bb6a);
}

/* XP Bar */
.xp-bar {
  width: 100%;
  height: 5px;
  background: rgba(0,0,0,0.3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.3rem;
}

.xp-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-glow));
  transition: width var(--transition-medium) ease;
}

/* Battle animation classes */
.attack-shake {
  animation: shake 0.5s ease;
}

.hit-flash {
  animation: hitFlash 0.3s ease;
}

.hit-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.4);
  animation: hitFlash 0.3s ease forwards;
  pointer-events: none;
}

.damage-float,
.damage-number {
  position: absolute;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--color-trainer);
  text-shadow: 0 2px 6px rgba(0,0,0,0.7);
  animation: floatUp 1s ease forwards;
  pointer-events: none;
  z-index: 100;
}

.damage-float.heal,
.damage-number.heal {
  color: var(--color-wild);
}

.damage-float.super-effective,
.damage-number.super-effective,
.super-effective {
  color: var(--color-wild);
  text-shadow: 0 0 10px rgba(102,187,106,0.6), 0 2px 6px rgba(0,0,0,0.7);
}

.damage-float.critical,
.damage-number.critical,
.critical-hit {
  color: var(--color-trainer);
  font-weight: 900;
  font-size: 1.8rem;
  text-shadow: 0 0 10px rgba(239,83,80,0.6), 0 2px 6px rgba(0,0,0,0.7);
}

.damage-float.not-effective,
.not-effective {
  color: rgba(224,224,255,0.4);
  font-size: 1.1rem;
}

/* Fainted */
.monster-card.fainted,
.fainted {
  filter: grayscale(1);
  transform: scale(0.9);
  opacity: 0.3;
  transition: all var(--transition-medium) ease;
}

/* Switch in */
.switch-in {
  animation: slideUp 0.5s ease;
}

/* Move display */
.move-display,
.move-name-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  text-shadow: 0 0 12px rgba(0,229,255,0.4), 0 2px 8px rgba(0,0,0,0.8);
  animation: moveAppear 0.6s ease forwards;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Battle log */
.battle-log {
  background: var(--color-bg-alt);
  border: 1px solid rgba(224,224,255,0.06);
  border-radius: 8px;
  padding: 0.75rem;
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.6;
  color: rgba(224,224,255,0.6);
}

.battle-log .log-entry {
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(224,224,255,0.03);
}

.battle-log .log-entry:last-child {
  border-bottom: none;
}

.battle-log .log-entry.important {
  color: var(--color-primary);
  font-weight: 600;
}

/* ============================================================
   5. SIDEBAR
   ============================================================ */

#sidebar,
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-bg-alt);
  border-left: 1px solid rgba(224,224,255,0.06);
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 50;
}

.sidebar-section {
  background: var(--color-bg-card);
  border-radius: 8px;
  padding: 0.65rem;
}

.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(224,224,255,0.4);
  margin-bottom: 0.5rem;
}

/* Team mini cards */
.team-mini-card,
.sidebar-monster {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  transition: background var(--transition-fast) ease;
  cursor: pointer;
}

.team-mini-card:hover,
.sidebar-monster:hover {
  background: rgba(224,224,255,0.04);
}

.team-mini-card .mini-sprite {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.team-mini-card .mini-info {
  flex: 1;
  min-width: 0;
}

.team-mini-card .mini-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-mini-card .mini-level {
  font-size: 0.6rem;
  color: rgba(224,224,255,0.4);
}

.team-mini-card .hp-bar {
  height: 5px;
  margin-top: 2px;
}

.team-mini-card.fainted {
  opacity: 0.35;
  filter: grayscale(0.8);
}

/* Gold counter */
.gold-counter,
.sidebar .gold {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-shop);
}

.gold-counter .gold-icon::before {
  content: '💰';
}

/* Badges */
.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.badge-item {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-bg-alt);
  border: 2px solid var(--color-gym);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.badge-item.empty {
  border-color: rgba(224,224,255,0.1);
  opacity: 0.3;
}

/* Bag items */
.bag-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0;
  font-size: 0.78rem;
}

.bag-item .item-count {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.7rem;
  margin-left: auto;
}

/* ============================================================
   6. SHOP
   ============================================================ */

#shop-screen,
.shop-screen {
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.shop-title {
  font-size: 1.3rem;
  color: var(--color-shop);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.shop-gold {
  font-size: 0.9rem;
  color: var(--color-shop);
  margin-bottom: 1rem;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.shop-item-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(255,167,38,0.12);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast) ease;
  text-align: center;
}

.shop-item-card:hover {
  border-color: var(--color-shop);
  box-shadow: 0 0 16px rgba(255,167,38,0.15);
  transform: translateY(-2px);
}

.shop-item-card .item-icon {
  font-size: 2rem;
}

.shop-item-card .item-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.shop-item-card .item-desc {
  font-size: 0.7rem;
  color: rgba(224,224,255,0.5);
  line-height: 1.4;
}

.shop-item-card .item-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-shop);
}

.btn-buy {
  width: 100%;
  padding: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255,167,38,0.15);
  color: var(--color-shop);
  border: 1px solid rgba(255,167,38,0.3);
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all var(--transition-fast) ease;
}

.btn-buy:hover {
  background: rgba(255,167,38,0.25);
  border-color: var(--color-shop);
}

.btn-buy:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ============================================================
   7. TRADE
   ============================================================ */

#trade-screen,
.trade-screen {
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.trade-title {
  font-size: 1.3rem;
  color: var(--color-trade);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.trade-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.trade-monster {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

.trade-arrow {
  font-size: 2rem;
  color: var(--color-trade);
  padding: 0 0.5rem;
  user-select: none;
  flex-shrink: 0;
}

.btn-trade {
  padding: 0.6rem 1.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(66,165,245,0.15);
  color: var(--color-trade);
  border: 1px solid rgba(66,165,245,0.3);
  border-radius: 8px;
  text-transform: uppercase;
  transition: all var(--transition-fast) ease;
  margin-top: 1rem;
}

.btn-trade:hover {
  background: rgba(66,165,245,0.25);
  border-color: var(--color-trade);
  box-shadow: 0 0 12px rgba(66,165,245,0.2);
}

/* ============================================================
   8. EVENT PANEL
   ============================================================ */

#event-screen,
.event-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 2rem;
  animation: fadeIn 0.3s ease;
}

.event-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(171,71,188,0.2);
  border-radius: 14px;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: scaleIn 0.4s ease;
}

.event-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.event-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-event);
  margin-bottom: 0.75rem;
}

.event-message,
.event-desc {
  font-size: 0.88rem;
  color: rgba(224,224,255,0.7);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.event-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.event-choice-btn {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--color-bg-alt);
  color: var(--color-text);
  border: 1px solid rgba(171,71,188,0.2);
  border-radius: 8px;
  transition: all var(--transition-fast) ease;
  text-align: left;
}

.event-choice-btn:hover {
  border-color: var(--color-event);
  background: rgba(171,71,188,0.1);
}

/* ============================================================
   9. MODALS & POPUPS
   ============================================================ */

.modal-overlay,
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal-card,
.popup-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(0,229,255,0.12);
  border-radius: 14px;
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  animation: scaleIn 0.3s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
}

.modal-close,
.popup-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(224,224,255,0.06);
  color: rgba(224,224,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast) ease;
}

.modal-close:hover,
.popup-close:hover {
  background: rgba(239,83,80,0.2);
  color: var(--color-trainer);
}

.modal-body {
  margin-bottom: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ============================================================
   10. MONSTER DETAIL POPUP
   ============================================================ */

.monster-detail {
  padding: 0.5rem 0;
}

.monster-detail .detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.monster-detail .detail-sprite {
  font-size: 3.5rem;
}

.monster-detail .detail-name {
  font-size: 1.3rem;
  font-weight: 700;
}

.monster-detail .detail-subtitle {
  font-size: 0.75rem;
  color: rgba(224,224,255,0.4);
}

/* Stat bars */
.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 1rem 0;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-label {
  width: 45px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(224,224,255,0.5);
  text-align: right;
  flex-shrink: 0;
}

.stat-bar {
  flex: 1;
  height: 7px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width var(--transition-medium) ease;
}

.stat-value {
  width: 28px;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Stat colors */
.stat-bar-fill.stat-hp    { background: #66bb6a; }
.stat-bar-fill.stat-atk   { background: #ef5350; }
.stat-bar-fill.stat-def   { background: #ffa726; }
.stat-bar-fill.stat-spatk { background: #42a5f5; }
.stat-bar-fill.stat-spdef { background: #ab47bc; }
.stat-bar-fill.stat-speed { background: #ec407a; }

/* Moves list */
.moves-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.75rem 0;
}

.move-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: var(--color-bg-alt);
  border-radius: 6px;
  font-size: 0.8rem;
}

.move-item .move-name {
  flex: 1;
  font-weight: 600;
}

.move-item .move-type {
  font-size: 0.6rem;
}

.move-item .move-power {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-primary);
  min-width: 30px;
  text-align: right;
}

.move-item .move-pp {
  font-size: 0.65rem;
  color: rgba(224,224,255,0.4);
  min-width: 35px;
  text-align: right;
}

/* Equip dropdown */
.equip-select {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.8rem;
  background: var(--color-bg-alt);
  color: var(--color-text);
  border: 1px solid rgba(0,229,255,0.15);
  border-radius: 6px;
  margin-top: 0.5rem;
  appearance: none;
  -webkit-appearance: none;
}

/* ============================================================
   11. MONSTERDEX
   ============================================================ */

#monsterdex-screen,
.monsterdex-screen {
  padding: 1.5rem;
}

.monsterdex-grid,
.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
}

.dex-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(224,224,255,0.06);
  border-radius: 8px;
  padding: 0.65rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
}

.dex-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.dex-card .dex-sprite {
  font-size: 2rem;
  margin-bottom: 0.3rem;
}

.dex-card .dex-name {
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dex-card .dex-number {
  font-size: 0.55rem;
  color: rgba(224,224,255,0.3);
}

.dex-card.undiscovered {
  opacity: 0.3;
  filter: grayscale(1);
}

.dex-card.undiscovered .dex-sprite {
  filter: brightness(0);
}

.dex-card.undiscovered .dex-name {
  color: rgba(224,224,255,0.2);
}

/* ============================================================
   12. ACHIEVEMENTS
   ============================================================ */

#achievements-screen,
.achievements-screen {
  padding: 1.5rem;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.achievement-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(224,224,255,0.06);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all var(--transition-fast) ease;
}

.achievement-card:hover {
  border-color: rgba(0,229,255,0.2);
}

.achievement-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

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

.achievement-name {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.achievement-desc {
  font-size: 0.7rem;
  color: rgba(224,224,255,0.5);
}

.achievement-card.locked {
  opacity: 0.35;
  filter: grayscale(0.6);
}

.achievement-card.locked .achievement-icon {
  filter: brightness(0.3);
}

.achievement-card.unlocked {
  border-color: rgba(0,229,255,0.2);
  box-shadow: 0 0 8px rgba(0,229,255,0.08);
}

/* ============================================================
   13. HALL OF FAME
   ============================================================ */

#hall-of-fame,
.hall-of-fame-screen {
  padding: 1.5rem;
}

.hof-title {
  font-size: 1.3rem;
  color: var(--color-shop);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hof-entries {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hof-entry {
  background: var(--color-bg-card);
  border: 1px solid rgba(255,167,38,0.12);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hof-entry .hof-rank {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--color-shop);
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.hof-entry .hof-info {
  flex: 1;
}

.hof-entry .hof-team {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.hof-entry .hof-team-sprite {
  font-size: 1.5rem;
}

.hof-entry .hof-date {
  font-size: 0.65rem;
  color: rgba(224,224,255,0.3);
}

.hof-entry .hof-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

/* ============================================================
   14. VICTORY SCREEN
   ============================================================ */

#victory-screen,
.victory-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.5s ease;
}

.victory-title {
  font-size: 3rem;
  font-weight: 900;
  color: var(--color-shop);
  text-shadow: 0 0 20px rgba(255,167,38,0.4), 0 0 40px rgba(255,167,38,0.2);
  animation: glow 2s ease-in-out infinite;
  margin-bottom: 1rem;
}

.victory-subtitle {
  font-size: 1.1rem;
  color: rgba(224,224,255,0.6);
  margin-bottom: 2rem;
}

/* Confetti – CSS only */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 10px;
  animation: confettiFall linear infinite;
  opacity: 0.9;
}

.confetti-piece:nth-child(1)  { left: 5%;  background: #ff6fff; animation-duration: 3s; animation-delay: 0s; }
.confetti-piece:nth-child(2)  { left: 15%; background: #00e5ff; animation-duration: 3.5s; animation-delay: 0.3s; }
.confetti-piece:nth-child(3)  { left: 25%; background: #66bb6a; animation-duration: 2.8s; animation-delay: 0.6s; }
.confetti-piece:nth-child(4)  { left: 35%; background: #ffa726; animation-duration: 3.2s; animation-delay: 0.1s; }
.confetti-piece:nth-child(5)  { left: 45%; background: #ef5350; animation-duration: 3.6s; animation-delay: 0.5s; }
.confetti-piece:nth-child(6)  { left: 55%; background: #42a5f5; animation-duration: 2.9s; animation-delay: 0.8s; }
.confetti-piece:nth-child(7)  { left: 65%; background: #ab47bc; animation-duration: 3.4s; animation-delay: 0.2s; }
.confetti-piece:nth-child(8)  { left: 75%; background: #ffd54f; animation-duration: 3.1s; animation-delay: 0.7s; }
.confetti-piece:nth-child(9)  { left: 85%; background: #ec407a; animation-duration: 3.3s; animation-delay: 0.4s; }
.confetti-piece:nth-child(10) { left: 95%; background: #00e5ff; animation-duration: 2.7s; animation-delay: 0.9s; }
.confetti-piece:nth-child(11) { left: 10%; background: #ef5350; animation-duration: 3.7s; animation-delay: 1.1s; width: 8px; height: 8px; }
.confetti-piece:nth-child(12) { left: 30%; background: #ff6fff; animation-duration: 2.6s; animation-delay: 1.3s; width: 12px; height: 12px; }
.confetti-piece:nth-child(13) { left: 50%; background: #66bb6a; animation-duration: 3.8s; animation-delay: 0.15s; width: 7px; height: 7px; }
.confetti-piece:nth-child(14) { left: 70%; background: #ffa726; animation-duration: 3.0s; animation-delay: 0.65s; width: 11px; height: 11px; }
.confetti-piece:nth-child(15) { left: 90%; background: #42a5f5; animation-duration: 3.4s; animation-delay: 1.0s; width: 9px; height: 9px; }

/* ============================================================
   15. GAME OVER SCREEN
   ============================================================ */

#game-over-screen,
.game-over-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
  animation: redPulse 3s ease-in-out infinite;
}

.game-over-title {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--color-trainer);
  text-shadow: 0 0 20px rgba(239,83,80,0.5), 0 0 60px rgba(239,83,80,0.3);
  animation: pulse 2s ease-in-out infinite;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.game-over-subtitle {
  font-size: 1.1rem;
  color: rgba(224,224,255,0.5);
  margin-bottom: 2rem;
}

.game-over-stats {
  background: var(--color-bg-card);
  border-radius: 10px;
  padding: 1.25rem 2rem;
  margin-bottom: 2rem;
  min-width: 250px;
}

.game-over-stat {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.88rem;
}

.game-over-stat .stat-key {
  color: rgba(224,224,255,0.5);
}

.game-over-stat .stat-val {
  font-weight: 700;
  color: var(--color-text);
}

/* ============================================================
   16. NAV BAR (fixed bottom)
   ============================================================ */

#nav-bar,
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: var(--sidebar-width);
  height: 50px;
  background: var(--color-bg-alt);
  border-top: 1px solid rgba(224,224,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0 0.5rem;
  z-index: 100;
}

.nav-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 6px;
  background: transparent;
  color: rgba(224,224,255,0.5);
  transition: all var(--transition-fast) ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.nav-btn:hover {
  background: rgba(224,224,255,0.06);
  color: var(--color-text);
}

.nav-btn.active {
  background: rgba(0,229,255,0.1);
  color: var(--color-primary);
}

.nav-btn .nav-icon {
  margin-right: 0.3rem;
}

/* ============================================================
   17. TOASTS (notifications)
   ============================================================ */

.toast-container {
  position: fixed;
  top: 1rem;
  right: calc(var(--sidebar-width) + 1rem);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 340px;
}

.toast {
  background: var(--color-bg-card);
  border: 1px solid rgba(0,229,255,0.15);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  color: var(--color-text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.toast-success {
  border-color: rgba(102,187,106,0.3);
}

.toast.toast-error {
  border-color: rgba(239,83,80,0.3);
}

.toast.toast-warning {
  border-color: rgba(255,167,38,0.3);
}

.toast.toast-info {
  border-color: rgba(0,229,255,0.3);
}

.toast.removing,
.toast.fade-out {
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.toast .toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast .toast-message {
  flex: 1;
}

/* ============================================================
   18. GENERIC BUTTONS
   ============================================================ */

.btn {
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  transition: all var(--transition-fast) ease;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  box-shadow: 0 0 16px rgba(0,229,255,0.3);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--color-bg-card);
  color: var(--color-text);
  border-color: rgba(224,224,255,0.12);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  background: rgba(0,229,255,0.08);
}

.btn-danger {
  background: rgba(239,83,80,0.15);
  color: var(--color-trainer);
  border-color: rgba(239,83,80,0.3);
}

.btn-danger:hover {
  background: rgba(239,83,80,0.25);
  border-color: var(--color-trainer);
}

.btn-small {
  padding: 0.3rem 0.7rem;
  font-size: 0.72rem;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: none;
}

/* ============================================================
   19. HEAL SCREEN
   ============================================================ */

#heal-screen,
.heal-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  gap: 1rem;
  animation: fadeIn 0.3s ease;
}

.heal-title {
  font-size: 1.3rem;
  color: var(--color-heal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.heal-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(236,64,122,0.15);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.heal-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.heal-message {
  font-size: 0.9rem;
  color: rgba(224,224,255,0.7);
  margin-bottom: 1rem;
}

.btn-heal {
  padding: 0.6rem 1.5rem;
  background: rgba(236,64,122,0.15);
  color: var(--color-heal);
  border: 1px solid rgba(236,64,122,0.3);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  transition: all var(--transition-fast) ease;
}

.btn-heal:hover {
  background: rgba(236,64,122,0.25);
  border-color: var(--color-heal);
  box-shadow: 0 0 12px rgba(236,64,122,0.2);
}

/* ============================================================
   20. REWARD / ENCOUNTER PANELS
   ============================================================ */

.reward-panel,
.encounter-panel {
  background: var(--color-bg-card);
  border: 1px solid rgba(0,229,255,0.1);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
  animation: scaleIn 0.3s ease;
}

.reward-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.reward-items {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.reward-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: var(--color-bg-alt);
  border-radius: 6px;
  font-size: 0.85rem;
}

.reward-item .reward-icon {
  font-size: 1.2rem;
}

/* Catch prompt */
.catch-prompt {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}

/* ============================================================
   21. DIFFICULTY / SETTINGS
   ============================================================ */

.settings-panel {
  max-width: 500px;
  margin: 0 auto;
  padding: 1.5rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(224,224,255,0.04);
}

.setting-label {
  font-size: 0.85rem;
}

.setting-control select,
.setting-control input[type="range"] {
  background: var(--color-bg-card);
  color: var(--color-text);
  border: 1px solid rgba(0,229,255,0.15);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

/* Toggle switch */
.toggle {
  width: 40px;
  height: 22px;
  background: rgba(224,224,255,0.1);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast) ease;
}

.toggle.on {
  background: rgba(0,229,255,0.3);
}

.toggle::after {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-text);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-fast) ease;
}

.toggle.on::after {
  transform: translateX(18px);
  background: var(--color-primary);
}

/* ============================================================
   22. SECTION HEADERS (reusable)
   ============================================================ */

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(224,224,255,0.06);
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  background: rgba(0,229,255,0.1);
  color: var(--color-primary);
  font-weight: 600;
}

/* ============================================================
   23. PROGRESS BARS (generic)
   ============================================================ */

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

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--color-primary);
  transition: width var(--transition-medium) ease;
}

/* ============================================================
   24. MONSTER CHOICE (picking starter, etc.)
   ============================================================ */

.monster-choice-grid {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 1rem 0;
}

.monster-choice-card {
  background: var(--color-bg-card);
  border: 2px solid rgba(224,224,255,0.08);
  border-radius: 12px;
  padding: 1.25rem;
  width: 160px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
}

.monster-choice-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 16px rgba(0,229,255,0.15);
}

.monster-choice-card.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 20px rgba(0,229,255,0.2);
}

.monster-choice-card .choice-sprite {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.monster-choice-card .choice-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.monster-choice-card .choice-type {
  font-size: 0.7rem;
  color: rgba(224,224,255,0.5);
}

/* ============================================================
   25. SCREEN TRANSITIONS
   ============================================================ */

.screen {
  animation: fadeIn 0.3s ease;
}

.screen-enter {
  animation: slideUp 0.4s ease;
}

.screen-exit {
  animation: fadeIn 0.3s ease reverse forwards;
}

/* ============================================================
   RESPONSIVE: Tablet (<=768px)
   ============================================================ */

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .main-content,
  #main-content {
    margin-right: 0;
    padding-bottom: 120px; /* room for bottom sidebar + nav */
  }

  #sidebar,
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 50px; /* above nav bar */
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    max-height: 180px;
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem;
    gap: 0.5rem;
    border-left: none;
    border-top: 1px solid rgba(224,224,255,0.06);
  }

  .sidebar-section {
    min-width: 140px;
    flex-shrink: 0;
  }

  #nav-bar,
  .nav-bar {
    right: 0;
  }

  .toast-container {
    right: 1rem;
  }

  /* Battle stacks vertically */
  .battle-arena {
    flex-direction: column;
  }

  .battle-side {
    align-items: center !important;
  }

  .battle-vs,
  .vs-divider {
    padding: 0.5rem 0;
  }

  .battle-vs::before,
  .vs-divider::before {
    width: 100%;
    height: 1px;
    top: 50%;
    left: 0;
    bottom: auto;
  }

  .monster-card {
    max-width: 100%;
  }

  /* Map adjustments */
  .map-node {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
  }

  .map-layer,
  .map-row {
    gap: 0.8rem;
  }

  /* Title screen */
  .game-title,
  #title-screen h1 {
    font-size: 2.8rem;
  }
}

/* ============================================================
   RESPONSIVE: Mobile (<=480px)
   ============================================================ */

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .game-title,
  #title-screen h1 {
    font-size: 2.2rem;
    letter-spacing: 0.1em;
  }

  .game-subtitle,
  #title-screen .subtitle {
    font-size: 0.9rem;
  }

  .title-menu button,
  .title-screen button,
  #title-screen .menu button {
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
  }

  /* Compact cards */
  .monster-card {
    padding: 0.75rem;
  }

  .monster-card .monster-sprite {
    font-size: 2.2rem;
  }

  .monster-card.active {
    min-height: 90px;
  }

  /* Smaller map nodes */
  .map-node {
    width: 42px;
    height: 42px;
    font-size: 1rem;
    border-width: 2px;
  }

  .map-layer,
  .map-row {
    gap: 0.5rem;
    padding: 0.4rem 0;
  }

  /* Shop grid */
  .shop-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
  }

  .shop-item-card {
    padding: 0.75rem;
  }

  /* Monsterdex */
  .monsterdex-grid,
  .dex-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.4rem;
  }

  .dex-card {
    padding: 0.4rem;
  }

  .dex-card .dex-sprite {
    font-size: 1.5rem;
  }

  /* Achievements */
  .achievements-grid {
    grid-template-columns: 1fr;
  }

  /* Modal */
  .modal-card,
  .popup-card {
    width: 95%;
    padding: 1rem;
  }

  /* Trade */
  .trade-container {
    flex-direction: column;
    align-items: center;
  }

  .trade-arrow {
    transform: rotate(90deg);
  }

  /* Sidebar on mobile: narrower */
  #sidebar,
  .sidebar {
    max-height: 140px;
    padding: 0.35rem;
  }

  .sidebar-section {
    min-width: 120px;
    padding: 0.4rem;
  }

  .team-mini-card .mini-sprite {
    font-size: 1.1rem;
  }

  .team-mini-card .mini-name {
    font-size: 0.65rem;
  }

  /* Nav bar */
  .nav-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.6rem;
  }

  /* Game over / victory titles */
  .game-over-title {
    font-size: 2.5rem;
  }

  .victory-title {
    font-size: 2.2rem;
  }

  /* Event card */
  .event-card {
    padding: 1.25rem;
  }

  /* Monster choice */
  .monster-choice-card {
    width: 130px;
    padding: 0.85rem;
  }

  .monster-choice-card .choice-sprite {
    font-size: 2rem;
  }
}

/* ============================================================
   PRINT (unlikely but clean)
   ============================================================ */

@media print {
  body {
    background: white;
    color: black;
  }

  #sidebar,
  .sidebar,
  #nav-bar,
  .nav-bar,
  .toast-container {
    display: none;
  }
}

/* ============================================================
   ACCESSIBILITY: Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   SELECTION
   ============================================================ */

::selection {
  background: rgba(0,229,255,0.3);
  color: var(--color-text);
}
