@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;600;700;900&family=Rajdhani:wght@400;500;600;700&display=swap');

:root {
  --bg:         #0e1a1b;
  --surface:    #141f20;
  --surface-2:  #1a2a2b;
  --surface-3:  #243536;
  --border:     rgba(255,255,255,0.07);
  --violet:     #9f53ec;
  --violet-dim: rgba(159,83,236,0.15);
  --orange:     #ff9d00;
  --orange-dim: rgba(255,157,0,0.15);
  --blue:       #4fc3f7;
  --blue-dim:   rgba(79,195,247,0.12);
  --green:      #4caf82;
  --red:        #ef5350;
  --yellow:     #ffd740;
  --text:       #cfe0e2;
  --text-dim:   #6a8587;
  --radius:     14px;
  --radius-sm:  8px;
}

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

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 1.5rem 1.5rem 3rem;
  margin-left: 250px;
  transition: margin-left 0.3s ease;
}
body.sidebar-collapsed { margin-left: 0; }

h1 {
  font-family: 'Exo 2', sans-serif;
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 40px rgba(159,83,236,0.4);
}

/* =============================================
   BATTLE CONTAINER
   ============================================= */

.battle-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.pokemon-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  transition: border-color 0.3s, box-shadow 0.3s;
  min-width: 0;
}

.attacker {
  border-color: rgba(159,83,236,0.4);
  box-shadow: 0 0 24px rgba(159,83,236,0.12);
}

.defender {
  border-color: rgba(255,157,0,0.4);
  box-shadow: 0 0 24px rgba(255,157,0,0.12);
}

/* =============================================
   POKEMON HEADER
   ============================================= */

.pokemon-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
}

.pokemon-image {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 0.7rem;
  background: var(--surface-2);
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.pokemon-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pokemon-header h2 {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-icon {
  font-size: 1.3rem;
  margin-top: 0.3rem;
}

/* =============================================
   SEARCH + GRILLE POKÉMON
   ============================================= */

.pokemon-search {
  width: 100%;
  padding: 8px 14px;
  margin-bottom: 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.pokemon-search:focus { border-color: var(--violet); }
.pokemon-search::placeholder { color: var(--text-dim); }

.pokemon-grid-wrapper {
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.pokemon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
  gap: 0.4rem;
}

.pokemon-grid-item {
  text-align: center;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  background: var(--surface-3);
  border: 1px solid transparent;
}

.pokemon-grid-item:hover {
  transform: scale(1.06);
  background: var(--surface-3);
  border-color: var(--border);
}

.pokemon-grid-item.selected {
  border-color: var(--violet);
  background: var(--violet-dim);
  box-shadow: 0 0 10px rgba(159,83,236,0.2);
}

.pokemon-grid-item img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.pokemon-grid-item span {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: 'Rajdhani', sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}

/* =============================================
   CATEGORY TABS
   ============================================= */

.category-tabs {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}

.tab-button {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-button:hover {
  background: var(--surface-3);
  color: var(--text);
}

.tab-button.active {
  background: var(--blue-dim);
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 10px rgba(79,195,247,0.15);
}

.attacker-tabs .tab-button.active {
  background: var(--violet-dim);
  border-color: var(--violet);
  color: var(--violet);
  box-shadow: 0 0 10px rgba(159,83,236,0.2);
}

/* =============================================
   ITEMS SECTION
   ============================================= */

.level-section, .items-section {
  margin-top: 0.8rem;
  padding: 0.8rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.items-section h3 {
  font-family: 'Exo 2', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  text-align: center;
  color: var(--text-dim);
}

.items-equipped-grid {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.item-equipped-card {
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  width: 108px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all 0.2s;
  position: relative;
  flex-shrink: 0;
}

.item-equipped-card.has-item {
  border-color: rgba(255,215,64,0.4);
  box-shadow: 0 0 10px rgba(255,215,64,0.1);
}

.item-equipped-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.4rem;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.item-equipped-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.item-equipped-name {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-equipped-stats {
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--blue);
  min-height: 18px;
}

.item-equipped-stacks {
  margin-top: 0.4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
}

.stacks-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
}

.stack-btn {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--yellow);
  color: #000;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  font-family: 'Exo 2', sans-serif;
}

.stack-value {
  min-width: 20px;
  font-weight: bold;
  color: var(--text);
  font-size: 0.85rem;
  text-align: center;
}

.stack-max {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.item-equipped-toggle {
  margin-top: 0.4rem;
  padding: 0.25rem 0.6rem;
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.72rem;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.item-equipped-toggle.active {
  background: rgba(76,175,130,0.2);
  border-color: var(--green);
  color: var(--green);
}

.reset-items-btn {
  margin: 0.6rem auto 0;
  padding: 0.35rem 0.9rem;
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
  display: block;
  width: fit-content;
}

.reset-items-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

/* =============================================
   VS
   ============================================= */

.vs-section {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vs-icon {
  font-family: 'Exo 2', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--yellow);
  text-shadow: 0 0 24px rgba(255,215,64,0.5);
  letter-spacing: 0.05em;
  animation: pulse 2s infinite;
}

/* =============================================
   MODAL ITEMS
   ============================================= */

.item-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.75);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
}

.item-modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.8rem;
  border-radius: var(--radius);
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(159,83,236,0.2);
}

.close-modal {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-dim);
  line-height: 1;
  transition: color 0.2s;
}
.close-modal:hover { color: var(--red); }

.item-search {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
.item-search:focus { border-color: var(--violet); }

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

.item-grid-item {
  text-align: center;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: all 0.2s;
}

.item-grid-item:hover {
  transform: scale(1.06);
  border-color: var(--border);
  background: var(--surface-3);
}

.item-grid-item img {
  width: 52px;
  height: 52px;
  margin: 0 auto;
  display: block;
}

.item-grid-item span {
  display: block;
  font-size: 0.72rem;
  font-family: 'Rajdhani', sans-serif;
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}

.item-grid-item.equipped-elsewhere { display: none; }

/* =============================================
   SLIDERS — Level + HP
   ============================================= */

.slider-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.slider-block label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Exo 2', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0;
}

.slider-block label span {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 6px;
}

.slider-block input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-2);
  outline: none;
  cursor: pointer;
  margin: 4px 0;
}

/* ── Attacker level track ── */
.attacker-stats .slider-block input[type="range"]:not(.hp-slider)::-webkit-slider-runnable-track,
.attacker .slider-block input[type="range"]:not(.hp-slider)::-webkit-slider-runnable-track {
  background: linear-gradient(to right,
    var(--violet) 0%,
    var(--violet) calc((var(--value, 15) - 1) / 14 * 100%),
    var(--surface-2) calc((var(--value, 15) - 1) / 14 * 100%),
    var(--surface-2) 100%
  );
  height: 5px;
  border-radius: 3px;
}

/* ── Defender level track ── */
.defender-stats .slider-block input[type="range"]:not(.hp-slider)::-webkit-slider-runnable-track,
.defender .slider-block input[type="range"]:not(.hp-slider)::-webkit-slider-runnable-track {
  background: linear-gradient(to right,
    var(--orange) 0%,
    var(--orange) calc((var(--value, 15) - 1) / 14 * 100%),
    var(--surface-2) calc((var(--value, 15) - 1) / 14 * 100%),
    var(--surface-2) 100%
  );
  height: 5px;
  border-radius: 3px;
}

/* ── Level thumbs ── */
.attacker-stats .slider-block input[type="range"]:not(.hp-slider)::-webkit-slider-thumb,
.attacker .slider-block input[type="range"]:not(.hp-slider)::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 3px; height: 16px;
  border-radius: 2px;
  background: var(--violet);
  border: none;
  box-shadow: 0 0 6px rgba(159,83,236,0.5);
  cursor: pointer;
}

.defender-stats .slider-block input[type="range"]:not(.hp-slider)::-webkit-slider-thumb,
.defender .slider-block input[type="range"]:not(.hp-slider)::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 3px; height: 16px;
  border-radius: 2px;
  background: var(--orange);
  border: none;
  box-shadow: 0 0 6px rgba(255,157,0,0.5);
  cursor: pointer;
}

/* ── HP track ── */
.hp-slider::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--red) 0%, var(--yellow) 30%, var(--green) 70%, var(--green) 100%);
  height: 5px;
  border-radius: 3px;
}

/* ── HP thumbs ── */
.attacker-stats .hp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 3px; height: 16px;
  border-radius: 2px;
  background: var(--violet);
  border: none;
  box-shadow: 0 0 6px rgba(159,83,236,0.5);
  cursor: pointer;
}
.defender-stats .hp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 3px; height: 16px;
  border-radius: 2px;
  background: var(--orange);
  border: none;
  box-shadow: 0 0 6px rgba(255,157,0,0.5);
  cursor: pointer;
}

/* ── Firefox ── */
.slider-block input[type="range"]::-moz-range-thumb {
  width: 3px; height: 16px;
  border-radius: 2px;
  border: none;
  cursor: pointer;
}
.attacker-stats .slider-block input[type="range"]:not(.hp-slider)::-moz-range-thumb,
.attacker .slider-block input[type="range"]:not(.hp-slider)::-moz-range-thumb {
  background: var(--violet); box-shadow: 0 0 6px rgba(159,83,236,0.5);
}
.defender-stats .slider-block input[type="range"]:not(.hp-slider)::-moz-range-thumb,
.defender .slider-block input[type="range"]:not(.hp-slider)::-moz-range-thumb {
  background: var(--orange); box-shadow: 0 0 6px rgba(255,157,0,0.5);
}
.attacker-stats .hp-slider::-moz-range-thumb { background: var(--violet); }
.defender-stats .hp-slider::-moz-range-thumb { background: var(--orange); }

.hp-display {
  text-align: center;
  font-family: 'Exo 2', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 3px 0;
}

.hp-value {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.3rem;
  text-align: center;
  padding: 0.5rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}
.hp-value:hover { border-color: var(--violet); }

/* =============================================
   RESULTS CONTAINER
   ============================================= */

.results-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr) minmax(0, 1fr);
  gap: 1.5rem;
  max-width: 1900px;
  margin: 0 auto 4rem;
  padding: 0;
  align-items: start;
}

.stats-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  height: fit-content;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  min-width: 0;
}

.attacker-stats { border-left: 3px solid var(--violet); }
.defender-stats  { border-left: 3px solid var(--orange); }

.stats-card h3 {
  font-family: 'Exo 2', sans-serif;
  text-align: center;
  color: #fff;
  margin-bottom: 1rem;
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pokemon-name-header {
  text-align: center;
  font-family: 'Exo 2', sans-serif;
  font-size: 1rem;
  color: var(--yellow);
  margin-bottom: 1.2rem;
  font-weight: 600;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.stats-pokemon-img {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stat-item .stat-label {
  font-family: 'Exo 2', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.stat-item .stat-value {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--blue);
  text-align: right;
}

/* =============================================
   MOVES SECTION
   ============================================= */

.moves-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  max-height: calc(70vh - 2rem);
  overflow-y: auto;
  position: sticky;
  top: 1rem;
  min-width: 0;
}

.moves-section h3 {
  font-family: 'Exo 2', sans-serif;
  text-align: center;
  color: #fff;
  margin-bottom: 1.5rem;
  font-size: 1.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 0 30px rgba(159,83,236,0.3);
}

.moves-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: 1.2rem;
}

.move-card {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 1.4rem;
  border: 1px solid var(--border);
  transition: all 0.3s;
  min-width: 0;
}

.move-card:hover {
  transform: translateY(-3px);
  border-color: rgba(159,83,236,0.4);
  box-shadow: 0 8px 24px rgba(159,83,236,0.15);
}

.move-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.move-title img {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(159,83,236,0.4);
  flex-shrink: 0;
}

.move-title strong {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.damage-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.damage-line:last-child { border-bottom: none; }

.dmg-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.dmg-name i {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.dmg-values {
  text-align: right;
  font-weight: bold;
}

.crit-chance {
  color: var(--red);
  font-weight: 700;
}

.dmg-normal {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--blue);
  text-shadow: 0 0 10px rgba(79,195,247,0.3);
}

.dmg-crit {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--red);
  display: block;
  margin-top: 0.2rem;
}

.damage-line.specs-bonus {
  background: var(--violet-dim);
  border-left: 3px solid var(--violet);
  padding-left: 0.8rem;
  margin: 0.5rem 0;
  border-radius: var(--radius-sm);
}

.damage-line.specs-bonus .dmg-name { color: var(--violet); font-weight: 700; }

/* =============================================
   CUSTOM DOLL
   ============================================= */

.editable-custom {
  cursor: pointer;
  color: var(--yellow);
  font-weight: 700;
  font-size: 1rem;
}

.editable-custom:hover {
  text-decoration: underline;
  color: #ffe98a;
}

.editable-custom::after {
  content: " ✏️";
  font-size: 0.8em;
  opacity: 0.7;
}

.custom-stat {
  background: rgba(255,215,64,0.07);
  border-radius: var(--radius-sm);
  padding: 3px 0;
}

.custom-doll-hint {
  text-align: center;
  font-size: 0.82rem;
  color: var(--yellow);
  background: rgba(255,215,64,0.06);
  border: 1px dashed rgba(255,215,64,0.3);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  margin-bottom: 0.5rem;
  animation: pulse 2s infinite;
}

/* =============================================
   WARNING BUTTON + MODAL
   ============================================= */

.warning-btn {
  position: fixed;
  top: 20px; right: 20px;
  background: var(--orange);
  color: #000;
  border: none;
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,157,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, filter 0.2s;
}
.warning-btn:hover { filter: brightness(1.15); transform: scale(1.08); }

.warning-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.75);
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.warning-modal-content {
  position: relative;
  background: var(--surface);
  color: var(--text);
  padding: 1.8rem;
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 60px rgba(255,157,0,0.25);
  border: 1px solid rgba(255,157,0,0.4);
}

.warning-modal-content h3 {
  font-family: 'Exo 2', sans-serif;
  text-align: center;
  color: var(--yellow);
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1.2rem;
}

.close-warning {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-dim);
  line-height: 1;
  transition: color 0.2s;
}
.close-warning:hover { color: var(--red); }

#warningText {
  margin-top: 0.8rem;
  line-height: 1.7;
  font-size: 0.95rem;
}
#warningText strong { color: var(--yellow); }
#warningText ul { padding-left: 1.4rem; margin: 0.8rem 0; }
#warningText li { margin-bottom: 0.4rem; }

/* =============================================
   ADDITIONAL EFFECTS
   ============================================= */

.additional-effects {
  margin-top: 0.8rem;
  padding: 0.8rem;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color 0.3s;
}

.additional-effects h3 {
  font-family: 'Exo 2', sans-serif;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.8rem 0;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s;
}

.additional-effects h3:hover {
  background: var(--surface-3);
  color: var(--text);
}

.additional-effects h3::before { content: "⚡"; margin-right: 8px; }
.attacker .additional-effects:nth-of-type(2) h3::before { content: "🔥"; }
.defender .additional-effects h3::before { content: "🛡️"; }

.additional-effects h3::after {
  content: "▼";
  font-size: 0.75rem;
  transition: transform 0.3s;
  flex-shrink: 0;
}

.additional-effects.collapsed h3::after {
  content: "▶";
  transform: rotate(-90deg);
}

.additional-effects:not(.collapsed) {
  border-color: rgba(159,83,236,0.3);
}
.defender .additional-effects:not(.collapsed) {
  border-color: rgba(255,157,0,0.3);
}

.buff-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  overflow: hidden;
  transition: all 0.35s ease;
  max-height: 2000px;
  opacity: 1;
}

.additional-effects.collapsed .buff-checkboxes {
  max-height: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  gap: 0;
}

.buff-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.buff-label:hover {
  background: var(--surface-3);
}

.attacker .additional-effects:first-of-type .buff-label,
.defender .additional-effects:first-of-type .buff-label { border-left-color: var(--green); }

.attacker .additional-effects:nth-of-type(2) .buff-label,
.defender .additional-effects:nth-of-type(2) .buff-label { border-left-color: var(--red); }

.buff-label::before { font-size: 1rem; }
.attacker .additional-effects:first-of-type .buff-label::before,
.defender .additional-effects:first-of-type .buff-label::before { content: "⬆️"; }
.attacker .additional-effects:nth-of-type(2) .buff-label::before,
.defender .additional-effects:nth-of-type(2) .buff-label::before { content: "⬇️"; }

.buff-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--yellow);
  cursor: pointer;
  flex-shrink: 0;
}

/* =============================================
   ABILITY STACKS
   ============================================= */

.ability-stacks-container {
  margin-top: 6px;
  margin-left: 24px;
  background: var(--surface-2);
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.ability-stack-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  justify-content: center;
}

.ability-stack-control .stack-btn {
  background: var(--yellow);
  color: #000;
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: 'Exo 2', sans-serif;
}

.ability-stack-control .stack-value {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-family: 'Exo 2', sans-serif;
  color: var(--blue);
}

.ability-stack-control .stack-max { color: var(--text-dim); }

.active-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.8rem;
}

/* =============================================
   ANIMATIONS
   ============================================= */

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

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

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

@media (max-width: 1400px) {
  .results-container {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr) minmax(0, 1fr);
  }
  .moves-grid { grid-template-columns: 1fr; }
  .pokemon-grid-wrapper { max-height: 180px; }
}

@media (max-width: 1100px) {
  .battle-container { grid-template-columns: 1fr; }
  .vs-section { padding: 0.4rem 0; }
  .results-container {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  .stats-card, .moves-section {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .moves-section { order: -1; }
  .moves-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  }
  body { padding: 1rem; }
}

@media (max-width: 768px) {
  body { padding: 1rem; margin-left: 0; }
  h1 { font-size: 1.4rem; margin-bottom: 1rem; }
  .pokemon-image { width: 90px; height: 90px; }
  .items-equipped-grid { flex-wrap: wrap; gap: 0.4rem; }
  .item-equipped-card { width: calc(33.33% - 0.4rem); min-width: 80px; }
  .pokemon-grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); }
  .pokemon-grid-item img { width: 40px; height: 40px; }
  .move-card { padding: 1rem; }
  .move-title strong { font-size: 1.1rem; }
  .dmg-normal { font-size: 1.5rem; }
  .buff-checkboxes { grid-template-columns: 1fr; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .item-grid-item img { width: 44px; height: 44px; }
}

@media (max-width: 480px) {
  body { padding: 0.7rem; }
  h1 { font-size: 1.1rem; letter-spacing: 0; }
  .pokemon-panel { padding: 0.7rem; border-radius: var(--radius-sm); }
  .pokemon-image { width: 76px; height: 76px; }
  .pokemon-header h2 { font-size: 0.95rem; }
  .tab-button { padding: 0.3rem 0.6rem; font-size: 0.72rem; }
  .item-equipped-card { width: calc(33.33% - 0.3rem); min-width: 68px; padding: 0.35rem; }
  .item-equipped-icon { width: 36px; height: 36px; }
  .item-equipped-name { font-size: 0.62rem; }
  .item-equipped-stats { display: none; }
  .pokemon-grid-wrapper { max-height: 150px; }
  .pokemon-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
  .pokemon-grid-item img { width: 34px; height: 34px; }
  .pokemon-grid-item span { font-size: 0.58rem; }
  .moves-section { padding: 0.9rem; }
  .move-card { padding: 0.8rem; }
  .dmg-normal { font-size: 1.3rem; }
  .dmg-name { font-size: 0.9rem; }
  .stats-card { padding: 0.9rem; }
  .stat-item .stat-value { font-size: 1.4rem; }
  .slider-block { padding: 0.6rem; }
}