/* ── TITLE SCREEN ──────────────────────────────────────────────────────────── */
.screen--title {
  position: relative;
  background: linear-gradient(160deg, var(--red) 0%, var(--red-dark) 100%);
  align-items: center;
  justify-content: center;
  gap: var(--sp-xl);
  padding: var(--sp-xl) var(--sp-lg);
}

.kanto-expert-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  cursor: default;
}

.kanto-expert-badge__tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 130px;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.7;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  z-index: 50;
  pointer-events: none;
  white-space: normal;
}

.kanto-expert-badge__tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 14px;
  border: 4px solid transparent;
  border-bottom-color: var(--black);
}

.kanto-expert-badge:hover .kanto-expert-badge__tooltip,
.kanto-expert-badge--open .kanto-expert-badge__tooltip { display: block; }

.title-logo {
  text-align: center;
}

.title-logo__main {
  font-family: var(--font-pixel);
  font-size: 22px;
  color: var(--yellow);
  text-shadow:
    3px 3px 0 var(--yellow-dark),
    6px 6px 0 rgba(0,0,0,.3);
  letter-spacing: 2px;
  line-height: 1.5;
  display: block;
}

.title-logo__sub {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: rgba(255,255,255,.7);
  margin-top: var(--sp-sm);
  letter-spacing: 3px;
}

.title-pokeball {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 5px solid var(--black);
  position: relative;
  overflow: hidden;
  animation: spin 8s linear infinite;
}

.title-pokeball__top { position: absolute; top: 0; left: 0; right: 0; height: 50%; background: var(--white); }
.title-pokeball__bot { position: absolute; bottom: 0; left: 0; right: 0; height: 50%; background: var(--off-white); }
.title-pokeball__band { position: absolute; top: 50%; left: 0; right: 0; height: 5px; background: var(--black); transform: translateY(-50%); }
.title-pokeball__center {
  position: absolute; top: 50%; left: 50%;
  width: 24px; height: 24px;
  background: var(--white);
  border: 4px solid var(--black);
  border-radius: 50%;
  transform: translate(-50%,-50%);
  z-index: 1;
}

@keyframes spin { to { transform: rotate(360deg); } }

.title-actions { display: flex; flex-direction: column; align-items: center; gap: var(--sp-sm); width: 100%; max-width: 240px; }

/* ── REGION SELECT ─────────────────────────────────────────────────────────── */
.screen--region {
  background: var(--off-white);
}

/* Estilos de .screen-header, .screen-header__back y .screen-header__title
   definidos más abajo (sección "HEADER CON TÍTULO CENTRADO") */

.region-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-lg);
  overflow-y: auto;
  flex: 1;
}

.region-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-md) var(--sp-lg);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--sp-md);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  width: 100%;
}
.region-card:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-md); }
.region-card:active { transform: translate(1px,1px); box-shadow: 2px 2px 0 var(--black); }

.region-card--locked {
  cursor: not-allowed;
  filter: grayscale(1);
}
.region-card--locked:hover { transform: none; box-shadow: var(--shadow-sm); }

.region-card__number {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--grey);
  flex-shrink: 0;
  width: 40px;
}

.region-card__name {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--black);
  flex: 1;
  line-height: 1.6;
}

.region-card__badge {
  font-family: var(--font-pixel);
  font-size: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--black);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  text-align: center;
}
.region-card__badge--available { background: var(--green); color: var(--white); }
.region-card__badge--soon      { background: var(--grey-light); color: var(--grey-dark); }

/* ── STARTER SELECT ────────────────────────────────────────────────────────── */
.screen--starter {
  background: var(--off-white);
  display: flex;
  flex-direction: column;
}

.starter-intro {
  padding: var(--sp-md) var(--sp-lg);
  text-align: center;
  flex-shrink: 0;
}

.starter-intro p {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--grey-dark);
  line-height: 1.8;
}

.starter-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: 0 var(--sp-md) var(--sp-md);
  overflow-y: auto;
  flex: 1;
}

.starter-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.starter-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 5px;
}
.starter-card[data-starter="bulbasaur"]::before  { background: var(--type-grass); }
.starter-card[data-starter="charmander"]::before { background: var(--type-fire); }
.starter-card[data-starter="squirtle"]::before   { background: var(--type-water); }

.starter-card:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-md); }
.starter-card:active { transform: translate(1px,1px); box-shadow: 2px 2px 0 var(--black); }

.starter-card__sprite-wrap {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--off-white);
  border: 2px solid var(--grey-light);
  border-radius: var(--radius-sm);
}

.starter-card__sprite {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
}

.starter-card__info { flex: 1; min-width: 0; }

.starter-card__name {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--black);
  margin-bottom: var(--sp-xs);
}

.starter-card__types { display: flex; gap: var(--sp-xs); margin-bottom: var(--sp-sm); flex-wrap: wrap; }

.starter-card__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.starter-stat {
  font-size: 9px;
  font-family: var(--font-body);
  color: var(--grey-dark);
}
.starter-stat span {
  font-weight: 700;
  color: var(--black);
}

.starter-card__nature {
  margin-top: var(--sp-xs);
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--grey);
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  flex-wrap: wrap;
}

.starter-card__arrow {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--grey);
  flex-shrink: 0;
  padding-right: var(--sp-xs);
}

/* ── Mode cards (pantalla de selección de modo de juego) ── */
.mode-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.mode-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 5px;
  background: var(--mode-accent, var(--red));
}
.mode-card:hover  { transform: translate(-2px,-2px); box-shadow: var(--shadow-md); }
.mode-card:active { transform: translate(1px,1px);   box-shadow: 2px 2px 0 var(--black); }

.mode-card__info  { flex: 1; min-width: 0; }

.mode-card__name {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--black);
  margin-bottom: var(--sp-xs);
}
.mode-card__desc {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--grey-dark);
  line-height: 1.5;
}
.mode-card__arrow {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--grey);
  flex-shrink: 0;
  padding-right: var(--sp-xs);
}

/* ── Battle Frontier — slots de equipo ── */
.bf-slot {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 2px dashed var(--grey-light);
  border-radius: var(--radius-sm);
  padding: 8px 4px 6px;
}
.bf-slot--filled {
  border-style: solid;
  border-color: var(--grey-light);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.bf-slot--filled:hover { border-color: var(--grey); }
.bf-slot--active {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(59,130,246,.2);
}
.bf-slot__sprite {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  object-fit: contain;
}
.bf-slot__name {
  font-family: var(--font-pixel);
  font-size: 5px;
  color: var(--black);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.bf-slot__hint {
  font-family: var(--font-pixel);
  font-size: 5px;
}
.bf-slot__num {
  font-family: var(--font-pixel);
  font-size: 18px;
  color: var(--grey-light);
  line-height: 1;
  margin: auto 0;
}

/* ── Battle Frontier — reglas desplegables ── */
.bf-rules summary::-webkit-details-marker { display: none; }
.bf-rules summary::marker { display: none; }
.bf-rules[open] .bf-rules__arrow { transform: rotate(90deg); transition: transform .2s; }

/* ── Battle Frontier — item cards ── */
.bf-item-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--sp-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.bf-item-card:hover  { transform: translate(-2px,-2px); box-shadow: var(--shadow-md); }
.bf-item-card:active { transform: translate(1px,1px);   box-shadow: 2px 2px 0 var(--black); }
.bf-item-card__img {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  object-fit: contain;
}
.bf-item-card__name {
  font-family: var(--font-pixel);
  font-size: 5px;
  color: var(--black);
  text-align: center;
  line-height: 1.4;
}
.bf-item-card--selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(26,111,191,.25);
  background: rgba(26,111,191,.06);
}
.bf-item-card--disabled {
  opacity: 0.35;
  filter: grayscale(1);
  cursor: default;
  pointer-events: none;
}

/* Fila de equipo en modo "eligiendo pokémon para objeto" */
.bf-row--selectable {
  border-color: var(--blue);
}
.bf-row--selectable:hover {
  background: rgba(26,111,191,.06);
}

/* Loading state */
.loading-sprite {
  width: 64px; height: 64px;
  background: var(--grey-light);
  border-radius: var(--radius-sm);
  animation: pulse 1s ease infinite alternate;
}
@keyframes pulse { from { opacity: .4; } to { opacity: 1; } }

/* ── ROUTE / ADVENTURE SCREEN ──────────────────────────────────────────────── */
.screen--adventure {
  background: var(--off-white);
  position: relative;
  overflow: hidden;
}

/* Fondo de la ruta — atenuado y desenfocado, capa independiente detrás
   del contenido (tarjetas de camino/equipo) */
.encounter-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(3px) brightness(.55) saturate(.6);
  transform: scale(1.05);
  z-index: 0;
}

.adventure-header {
  background: var(--blue);
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.adventure-header__route {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--white);
}

.adventure-header__balls {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--white);
  opacity: .8;
}

.team-bar {
  display: flex;
  gap: 6px;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--white);
  border-top: var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.team-pip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--off-white);
  border: 2px solid var(--black);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  cursor: grab;
  min-width: 0;
}

.team-pip__sprite { width: var(--team-pip-sprite-size); height: var(--team-pip-sprite-size); image-rendering: pixelated; flex-shrink: 0; }
.team-pip__info   { min-width: 0; flex: 1; }
.team-pip__name   { font-family: var(--font-pixel); font-size: var(--team-pip-font-size); color: var(--black); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-pip__level  { font-family: var(--font-pixel); font-size: var(--team-pip-font-size); color: var(--grey); }
.team-pip__hp     { width: 100%; margin-top: 2px; }

.team-pip--fainted { opacity: .35; filter: grayscale(1); }
.team-pip--dragover { border-color: var(--yellow); background: #fffbe0; }
.team-pip--dragging { opacity: .3; }

.encounter-area {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--sp-md);
  gap: var(--sp-sm);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1;
}

.encounter-prompt {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--grey-dark);
  text-align: center;
  line-height: 1.8;
}

.encounter-counter {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--grey);
}

.encounter-choices {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  width: 100%;
}

.encounter-btn {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-md);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  text-align: left;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.encounter-btn:hover  { transform: translate(-2px,-2px); box-shadow: var(--shadow-md); }
.encounter-btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--black); }

.encounter-btn__icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}
.encounter-btn__label {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--black);
  line-height: 1.8;
}
.encounter-btn__sub {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--grey);
  line-height: 1.4;
  margin-top: 2px;
}
.encounter-btn--skip { opacity: .7; }

/* ── TRAINER BAR — dentro del campo, encima del HUD del rival ─────────────── */
.trainer-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: var(--trainer-bar-bg);
  padding: 5px var(--sp-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  z-index: 10;
  height: var(--trainer-bar-height);
}

.trainer-bar__name {
  font-family: var(--font-pixel);
  font-size: var(--trainer-bar-name-size);
  color: var(--white);
  letter-spacing: 0.5px;
}

.trainer-bar__balls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.trainer-ball {
  font-size: var(--trainer-ball-size);
  transition: color 200ms;
}
.trainer-ball--alive   { color: #FF4444; }
.trainer-ball--fainted { color: rgba(0,0,0,.18); }

/* ── COMBAT SCREEN ─────────────────────────────────────────────────────────── */
.screen--combat {
  background: var(--off-white);
  display: flex;
  flex-direction: column;
}

.combat-field {
  flex: 0 0 auto;
  position: relative;
  background: linear-gradient(180deg, #87CEEB 0%, #87CEEB 55%, #8DB870 55%, #6A9B50 100%);
  /* border-bottom: var(--border); */
  height: var(--combat-field-height);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

/* Sky detail */
.combat-field::before {
  content: '';
  position: absolute;
  top: 20px; left: 30px;
  width: 60px; height: 20px;
  background: rgba(255,255,255,.6);
  border-radius: 10px;
  box-shadow: 80px 10px 0 50px rgba(255,255,255,.5);
}

.combat-foe {
  position: absolute;
  top: 30px;
  right: var(--sp-lg);
}

.combat-player {
  position: absolute;
  bottom: -35px;
  left: var(--sp-lg);
}

.combat-sprite {
  image-rendering: pixelated;
  object-fit: contain;
}
.combat-sprite--foe    {
  width: var(--combat-sprite-foe-size);
  height: var(--combat-sprite-foe-size);
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,.3));
}
.combat-sprite--player {
  width: var(--combat-sprite-player-size);
  height: var(--combat-sprite-player-size);
  filter: drop-shadow(-2px 2px 0 rgba(0,0,0,.3));
}

.combat-sprite--hit {
  animation: hit-flash 300ms ease;
}
@keyframes hit-flash {
  0%   { filter: brightness(10); }
  50%  { filter: brightness(10); }
  100% { filter: none; }
}

.combat-hud {
  position: absolute;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: none;
  padding: var(--combat-hud-padding);
  min-width: var(--combat-hud-min-width);
}
.combat-hud--foe    { top: 30px; left: 1px; }
.combat-hud--player { bottom: 30px; right: 1px; }

.combat-hud__name {
  font-family: var(--font-pixel);
  font-size: var(--combat-hud-name-size);
  color: var(--black);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-sm);
  margin-bottom: 4px;
  position: relative;
  top: 1px;
}
.combat-hud__level {
  font-family: var(--font-pixel);
  font-size: var(--combat-hud-level-size);
  color: var(--grey);
}


.combat-hud .hp-bar-wrap { height: var(--combat-hud-bar-height); }

.combat-hud__hp-nums {
  font-family: var(--font-pixel);
  font-size: var(--combat-hud-nums-size);
  color: var(--grey-dark);
  text-align: right;
  margin-top: 3px;
  position: relative;
  top: 1px;
}

.combat-log {
  padding: 10px var(--sp-md) 10px var(--sp-md);
  background: var(--white);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  /* Marco Gen 1: borde negro grueso con esquinas pixel */
  border: 3px solid var(--black);
  border-left: none;
  border-right: none;
  position: relative;
  min-height: var(--combat-log-min-height);
  box-shadow: inset 0 3px 0 var(--black), inset 0 -3px 0 var(--black);
}

/* Esquinas estilo pixel Gen 1 */
.combat-log::before,
.combat-log::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--black);
}
.combat-log::before { top: -3px;  left: 0;   box-shadow: 3px 0 0 var(--black); }
.combat-log::after  { bottom: -3px; left: 0; box-shadow: 3px 0 0 var(--black); }

.combat-log__text {
  font-family: var(--font-pixel);
  font-size: var(--combat-log-font-size);
  color: var(--black);
  line-height: 1.8;
}

.combat-log__text--dimmed { color: var(--grey); }

/* 8. Moves: full width list, no PP, show power */
.combat-actions {
  padding: var(--sp-sm) var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.move-btn {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-md) var(--sp-lg);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  text-align: left;
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: var(--move-btn-min-height);
}
.move-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: var(--move-btn-bar-width);
}

.move-btn__name {
  font-family: var(--font-pixel);
  font-size: var(--move-btn-name-size);
  padding-left: 10px;
  color: var(--black);
}
.move-btn__meta {
  font-size: 10px;
  font-family: var(--font-body);
  color: var(--grey);
  padding-left: 10px;
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
  flex-shrink: 0;
}

/* Type-coloured left border on move buttons */
.move-btn[data-type="fire"]::before     { background: var(--type-fire); }
.move-btn[data-type="water"]::before    { background: var(--type-water); }
.move-btn[data-type="grass"]::before    { background: var(--type-grass); }
.move-btn[data-type="electric"]::before { background: var(--type-electric); }
.move-btn[data-type="normal"]::before   { background: var(--type-normal); }
.move-btn[data-type="poison"]::before   { background: var(--type-poison); }
.move-btn[data-type="psychic"]::before  { background: var(--type-psychic); }
.move-btn[data-type="ice"]::before      { background: var(--type-ice); }
.move-btn[data-type="fighting"]::before { background: var(--type-fighting); }
.move-btn[data-type="bug"]::before      { background: var(--type-bug); }
.move-btn[data-type="rock"]::before     { background: var(--type-rock); }
.move-btn[data-type="ghost"]::before    { background: var(--type-ghost); }
.move-btn[data-type="dragon"]::before   { background: var(--type-dragon); }
.move-btn[data-type="dark"]::before     { background: var(--type-dark); }
.move-btn[data-type="steel"]::before    { background: var(--type-steel); }
.move-btn[data-type="fairy"]::before    { background: var(--type-fairy); }
.move-btn[data-type="ground"]::before   { background: var(--type-ground); }
.move-btn[data-type="flying"]::before   { background: var(--type-flying); }

.move-btn:hover  { transform: translate(-1px,-1px); box-shadow: var(--shadow-md); }
.move-btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--black); }
.move-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }

/* Versión solo informativa — sin animaciones de hover/active, no es clicable */
.move-btn--display:hover,
.move-btn--display:active {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.move-btn__name {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--black);
  padding-left: 6px;
}
.move-btn__meta {
  font-size: 9px;
  font-family: var(--font-body);
  color: var(--grey);
  padding-left: 6px;
  display: flex;
  gap: var(--sp-xs);
  align-items: center;
}

.combat-extra-actions {
  display: flex;
  gap: var(--sp-sm);
  padding: var(--sp-xs) var(--sp-md) var(--sp-sm);
  flex-shrink: 0;
}

/* ── COMBAT TEAM BAR — lista de pokemon bajo los botones de ataque ────────── */
.combat-team-bar {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px var(--sp-md);
  background: var(--white);
  border-top: 2px solid var(--grey-light);
  flex-shrink: 1;
  min-height: 80px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.combat-team-pip {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 4px var(--sp-sm);
  border: 2px solid var(--grey-light);
  border-radius: var(--radius-sm);
  background: var(--off-white);
  min-width: 0;
  overflow: hidden;
}
.combat-team-pip--active  { border-color: var(--blue); background: #e8f4ff; }
.combat-team-pip--fainted { opacity: .35; filter: grayscale(1); }

.combat-team-pip__sprite {
  width: 52px;
  height: 52px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.combat-team-pip__item-slot {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.combat-team-pip__item-slot img {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  object-fit: contain;
}

.combat-team-pip__level {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--grey);
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Fila nivel (izq) + HP nums (der) bajo la barra */
.combat-team-pip__hp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

/* HP section: barra + números, ancho fijo igual para todos */
.combat-team-pip__hp-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.combat-team-pip__hp-bar {
  /* Hereda de .hp-bar-wrap pero con altura mayor */
  height: 10px;
}

.combat-team-pip__hp-nums {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--grey-dark);
  text-align: right;
}

/* ── BETWEEN-ROUTE MENU ────────────────────────────────────────────────────── */
.screen--between {
  background: var(--off-white);
}

.between-team {
  padding: var(--sp-md);
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.team-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-sm) var(--sp-md);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  cursor: grab;
}
.team-card--fainted { opacity: .5; filter: grayscale(.8); }
.team-card--dragging { opacity: .3; }
.team-card--dragover { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow); }

.team-card__sprite { width: 40px; height: 40px; image-rendering: pixelated; flex-shrink: 0; }
.team-card__info   { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-sm); }
.team-card__name   { font-family: var(--font-pixel); font-size: 8px; color: var(--black); }
.team-card__level  { font-family: var(--font-pixel); font-size: 7px; color: var(--grey); flex-shrink: 0; }
.team-card__handle { font-size: 16px; color: var(--grey-light); flex-shrink: 0; cursor: grab; }

.between-actions {
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  flex-shrink: 0;
  border-top: var(--border);
  background: var(--off-white);
}

/* ── ITEM REWARD ───────────────────────────────────────────────────────────── */
.item-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: var(--sp-sm);
  padding: var(--sp-md);
}

.item-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-md) var(--sp-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  text-align: center;
}
.item-card:hover  { transform: translate(-2px,-2px); box-shadow: var(--shadow-md); }
.item-card:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--black); }

.item-card__icon {
  font-size: 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-card__name { font-family: var(--font-pixel); font-size: 6px; color: var(--black); line-height: 1.6; }
.item-card__desc { font-family: var(--font-body); font-size: 9px; color: var(--grey); }

/* ── MODAL / OVERLAY ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  animation: fade-in 150ms ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  background: var(--off-white);
  border: var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  padding: var(--sp-lg) var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  animation: sheet-up 200ms ease;
}
@keyframes sheet-up { from { transform: translateY(30px); } to { transform: translateY(0); } }

.modal-title {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--black);
  text-align: center;
}

/* ── CUENTA (account-screen.js) ────────────────────────────────────────────── */
/* Botón CUENTA del título con sesión iniciada */
.account-title-btn--logged,
.account-title-btn--logged:hover { background: var(--green); color: var(--white); }

/* Nombre de la cuenta y estado de sincronización, arriba a la derecha del título */
.title-account {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  max-width: 45%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: var(--font-pixel);
  color: var(--white);
  text-shadow: 2px 2px 0 var(--red-dark);
}
.title-account[hidden] { display: none; }
.title-account__name,
.title-account__sync {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title-account__name { font-size: 8px; line-height: 1.4; }
.title-account__sync { font-size: 5px; line-height: 1.4; opacity: .8; }
.title-account__sync:empty { display: none; }
.title-account__sync[data-state="error"] { color: var(--yellow); opacity: 1; }

/* Estado de red arriba a la izquierda: icono sin conexión + spinner de envío
   (connection-indicator.js / account-screen.js). Compacto para no tapar el HUD
   del rival en combate (top: 30px). No captura clics salvo el tooltip del icono. */
.net-status {
  position: fixed;
  top: 6px;
  left: 6px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
/* En el título, a la derecha de la insignia de Experto de Kanto */
body:has(.kanto-expert-badge) .net-status { left: 84px; }

.connection-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 4px;
  border-radius: 5px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--yellow);
  line-height: 0;
  cursor: help;
  pointer-events: auto;
}
.connection-indicator[hidden] { display: none; }

.sync-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: var(--white);
  border-radius: 50%;
  filter: drop-shadow(0 0 1px rgba(0,0,0,.8));
  animation: spin .7s linear infinite;
}
.sync-spinner[hidden] { display: none; }

.account-sheet { max-height: 100%; overflow-y: auto; }

.account-tabs { display: flex; gap: var(--sp-sm); }
.account-tab {
  flex: 1;
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: 10px 4px;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--grey);
  cursor: pointer;
}
.account-tab--active { background: var(--blue); color: var(--white); }

.account-form { display: flex; flex-direction: column; gap: 10px; }

.account-field { display: flex; flex-direction: column; gap: 6px; }
.account-field__label {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--grey-dark);
}
.account-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px; /* ≥16px evita el zoom automático en iOS */
  font-weight: 700;
  padding: 8px 10px;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black);
  outline: none;
}
.account-input:focus { border-color: var(--blue); }

.account-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--grey-dark);
  line-height: 1.6;
  cursor: pointer;
}
.account-check input { width: 18px; height: 18px; flex-shrink: 0; }

.account-msg {
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.8;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.account-msg[hidden] { display: none; }
.account-msg[data-kind="error"] { color: var(--red-dark); background: #fde0dc; border: 1px solid var(--red); }
.account-msg[data-kind="ok"]    { color: var(--green-dark); background: #e0f5e3; border: 1px solid var(--green); }

.account-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  text-align: center;
}
.account-card__name {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--black);
  word-break: break-all;
}
.account-card__line {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  color: var(--grey);
  word-break: break-all;
}
.account-card__warn {
  display: inline-block;
  margin-left: 4px;
  font-family: var(--font-pixel);
  font-size: 5px;
  color: var(--red-dark);
}

.account-actions { display: flex; flex-direction: column; gap: var(--sp-sm); }

.account-note {
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.9;
  color: var(--grey-dark);
  text-align: center;
}

/* ── VICTORY SCREEN ────────────────────────────────────────────────────────── */
.screen--victory {
  background: linear-gradient(160deg, var(--yellow) 0%, var(--yellow-dark) 100%);
  align-items: center;
  justify-content: center;
  gap: var(--sp-xl);
  padding: var(--sp-xl) var(--sp-lg);
  text-align: center;
}

.victory-title {
  font-family: var(--font-pixel);
  font-size: 18px;
  color: var(--white);
  text-shadow: 3px 3px 0 var(--grey), 6px 6px 0 rgba(0,0,0,.2);
  line-height: 1.6;
  animation: victory-pop 400ms cubic-bezier(.36,2,.4,1) both;
}
@keyframes victory-pop {
  from { transform: scale(.4); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

.victory-badge {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--sp-md) var(--sp-xl);
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--black);
  line-height: 1.8;
}

/* ── DEFEAT SCREEN ─────────────────────────────────────────────────────────── */
.screen--defeat {
  background: linear-gradient(160deg, var(--grey-dark) 0%, var(--black) 100%);
  align-items: center;
  justify-content: center;
  gap: var(--sp-xl);
  padding: var(--sp-xl) var(--sp-lg);
  text-align: center;
}

.defeat-title {
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--red-light);
  line-height: 1.6;
  text-shadow: 2px 2px 0 var(--red-dark);
}

/* ── CAPTURE PROMPT ────────────────────────────────────────────────────────── */
.capture-modal {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  align-items: center;
}

.pokeball-throw {
  font-size: 48px;
  animation: throw 600ms ease forwards;
}
@keyframes throw {
  0%   { transform: translateY(0) rotate(0); }
  40%  { transform: translateY(-20px) rotate(180deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

.pokeball-count {
  display: flex;
  gap: var(--sp-xs);
  flex-wrap: wrap;
  justify-content: center;
}

/* ── POKÉDEX ────────────────────────────────────────────────────────────────── */
.dex-entry {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 6px var(--sp-sm);
  border: 2px solid var(--grey-light);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: default;
}

.dex-entry--caught {
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.dex-entry--caught:hover  { transform: translate(-1px,-1px); box-shadow: var(--shadow-sm); }
.dex-entry--caught:active { transform: translate(1px,1px); }

.dex-entry--unseen { opacity: .55; }

.dex-entry__num {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--grey);
  width: 28px;
  flex-shrink: 0;
}

.dex-entry__sprite-wrap {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dex-entry__sprite {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}

.dex-entry__silhouette {
  font-family: var(--font-pixel);
  font-size: 18px;
  color: var(--grey-light);
}

.dex-entry__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dex-entry__name {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--black);
}

.dex-entry__types {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.dex-entry__ev-badge {
  font-family: var(--font-pixel);
  font-size: 5px;
  background: var(--blue);
  color: white;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--black);
  flex-shrink: 0;
}

/* ── LOGRO CARD ────────────────────────────────────────────────────────────── */

.logro-entry {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 6px var(--sp-sm);
  border: 2px solid var(--grey-light);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.logro-entry--locked {
  opacity: .35;
  filter: grayscale(1);
}

.logro-entry--done {
  border-left: 3px solid #e0a800;
}


.logro-entry__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.logro-entry__name {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--black);
}

.logro-entry__desc {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--grey);
}

.logro-entry__star {
  font-size: 14px;
  color: #e0a800;
  flex-shrink: 0;
  line-height: 1;
}

/* ── STAT CHANGE INDICATOR en el HUD ──────────────────────────────────────── */
.stat-change {
  font-family: var(--font-pixel);
  font-size: 6px;
  padding: 2px 4px;
  border-radius: 2px;
  animation: stat-pop 2400ms ease forwards;
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  text-align: center;
  pointer-events: none;
  word-break: break-word;
}
.stat-change--up   { color: var(--green-dark); background: #d4f5d4; border: 1px solid var(--green); }
.stat-change--down { color: var(--red-dark);   background: #fde0dc; border: 1px solid var(--red);   }

@keyframes stat-pop {
  0%   { opacity: 0; transform: translateY(4px); }
  15%  { opacity: 1; transform: translateY(0);   }
  70%  { opacity: 1; transform: translateY(0);   }
  100% { opacity: 0; transform: translateY(-6px); }
}

/* ── COMBAT INTRO ANIMATION ────────────────────────────────────────────────── */

/* Texto de intro que entra por la derecha y sale por la izquierda */
.combat-intro-text {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  transform: translateY(-50%);
  font-family: var(--font-pixel);
  font-size: 11px;
  line-height: 1.7;
  color: var(--black);
  text-align: center;
  padding: var(--sp-sm) var(--sp-md);
  background: rgba(255,255,255,.85);
  border-top: 3px solid var(--black);
  border-bottom: 3px solid var(--black);
  z-index: 20;
  animation: intro-slide 1800ms cubic-bezier(.4,0,.2,1) forwards;
}

@keyframes intro-slide {
  0%   { clip-path: inset(0 100% 0 0); }
  25%  { clip-path: inset(0 0% 0 0);   }
  70%  { clip-path: inset(0 0% 0 0);   }
  100% { clip-path: inset(0 0 0 100%); }
}

/* Sprite del foe que aparece desde la derecha */
.combat-sprite--foe-enter {
  animation: foe-enter 500ms cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes foe-enter {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* HUD foe que aparece desde arriba */
.combat-hud--foe-enter {
  animation: hud-enter 400ms ease 300ms both;
}
@keyframes hud-enter {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── ROUTE TEAM ROW — lista full-width del equipo en pantalla de ruta ─────── */
.route-team-row {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 6px var(--sp-sm);
  background: var(--white);
  border: 2px solid var(--grey-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  width: 100%;
}
.route-team-row:hover  { transform: translate(-1px,-1px); box-shadow: var(--shadow-md); }
.route-team-row:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--black); }
.route-team-row--fainted { opacity: .4; filter: grayscale(.8); }

.route-team-row__sprite { width: 36px; height: 36px; image-rendering: pixelated; flex-shrink: 0; }
.route-team-row__info   { flex: 0 0 auto; min-width: 0; }
.route-team-row__info .hp-bar-wrap { width: 140px; }
.route-team-row__name   { font-family: var(--font-pixel); font-size: 10px; color: var(--black); display: inline-flex; align-items: center; gap: 3px; }
.route-team-row__level  { font-family: var(--font-pixel); font-size: 8px;  color: var(--grey); }

/* ── PATH NODES ROW ─────────────────────────────────────────────────────────── */
.path-nodes-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.path-node-img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  object-fit: contain;
  display: block;
}

.path-node-sep {
  color: var(--grey-light);
  font-size: 12px;
  flex-shrink: 0;
  line-height: 1;
}

@media (max-width: 480px) {
  .combat-player { left: -10px; }
  .combat-foe { right: -12px; }
  #btn-pause-combat { display: none; }

  .path-node-img {
    max-width: 24px;
    width: 100%;
    height: auto;
  }
  .path-nodes-row {
    gap: 2px;
  }
  .path-node-sep {
    font-size: 9px;
  }
}

/* ── PATH ENCOUNTER TOOLTIP ─────────────────────────────────────────────────── */
.path-encounter-cell { cursor: default; }

.path-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: var(--white);
  font-family: var(--font-pixel);
  font-size: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
  line-height: 1.6;
}

/* Flechita del tooltip */
.path-tooltip::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--black);
}

.path-encounter-cell:hover .path-tooltip { display: block; }

/* BF path — tooltip hacia abajo (el header no deja espacio arriba) */
.bf-path .path-tooltip {
  bottom: auto;
  top: calc(100% + 6px);
}
.bf-path .path-tooltip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--black);
}

.combat-team-pip__hp-bar { height: 10px; }

/* ── STATUS BADGES — estado y modificadores persistentes en el HUD ─────────── */
.hud-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
  min-height: 0;
}

.status-badge {
  font-family: var(--font-pixel);
  font-size: 5px;
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.stat-mod-badge {
  font-family: var(--font-pixel);
  font-size: 5px;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.stat-mod-badge--up         { color: var(--green-dark); background: #d4f5d4; border: 1px solid var(--green); }
.stat-mod-badge--down       { color: var(--red-dark);   background: #fde0dc; border: 1px solid var(--red);   }
.stat-mod-badge--collapsed  {
  color: var(--grey-dark);
  background: #f0f0f0;
  border: 1px solid var(--grey);
  position: relative;
  cursor: default;
}
.combat-hud:hover                    { z-index: 9999; }
.combat-hud:hover .stat-mod-tooltip  { display: block; }
.combat-hud--foe .stat-mod-tooltip   { bottom: auto; top: calc(100% + 4px); }
.stat-mod-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  line-height: 2;
}

/* ── MOVE EFFECT TOOLTIP (posición fixed via JS, escapa overflow containers) ─ */
.move-effect-tooltip {
  position: fixed;
  display: block;
  transform: translateX(-50%);
  background: var(--black);
  color: var(--white);
  font-family: var(--font-pixel);
  font-size: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  line-height: 1.8;
}
.move-effect-tooltip::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--black);
}

/* ── MOVES LIST SCROLL (oculta scrollbar para evitar artefactos en móvil) ─── */
.moves-list-scroll {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 55vh;
  scrollbar-width: none;
}
.moves-list-scroll::-webkit-scrollbar { display: none; }

/* ── DAMAGE / HEAL FLOATERS ─────────────────────────────────────────────────── */
.combat-floater {
  position: absolute;
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: bold;
  pointer-events: none;
  z-index: 30;
  animation: floater-up 1000ms ease forwards;
}
.combat-floater--dmg   { color: #FF2222; text-shadow: 1px 1px 0 #000; }
.combat-floater--crit  { color: #FF2222; font-size: 15px; text-shadow: 2px 2px 0 #000; }
.combat-floater--heal  { color: #22CC44; text-shadow: 1px 1px 0 #003300; }

@keyframes floater-up {
  0%   { opacity: 0; transform: translateY(0) scale(.8); }
  20%  { opacity: 1; transform: translateY(-6px) scale(1); }
  70%  { opacity: 1; transform: translateY(-18px) scale(1); }
  100% { opacity: 0; transform: translateY(-30px) scale(.9); }
}

/* ── FAINT ANIMATION ────────────────────────────────────────────────────────── */
.combat-sprite--fainting {
  animation: sprite-faint 700ms ease forwards;
  filter: grayscale(1) brightness(.4);
}
@keyframes sprite-faint {
  0%   { transform: translateY(0);   opacity: 1; filter: grayscale(0) brightness(1); }
  30%  { transform: translateY(0);   opacity: 1; filter: grayscale(1) brightness(.4); }
  100% { transform: translateY(40px);opacity: 0; filter: grayscale(1) brightness(.4); }
}

/* ── COMBAT TRANSITION CURTAIN ──────────────────────────────────────────────── */
/* Cubre el viewport durante el reemplazo de DOM entre encuentros para evitar   */
/* el frame en blanco. Se añade a #app (fuera de #viewport) y se desvanece.     */
.combat-curtain {
  position: absolute;
  inset: 0;
  z-index: 9999;
  background: var(--black);
  pointer-events: none;
}
.combat-curtain--fade-out {
  animation: combatCurtainOut 0.22s ease-out forwards;
}
@keyframes combatCurtainOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ── SHINY BATTLE ANIMATION ─────────────────────────────────────────────────── */
.shiny-battle-anim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 20;
  animation: shinyBattleFadeOut var(--shiny-anim-duration, 2s) ease-out forwards;
}
@keyframes shinyBattleFadeOut {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── LEVEL UP PIP ANIMATION ─────────────────────────────────────────────────── */
.combat-team-pip--levelup {
  animation: pip-grey 900ms ease forwards;
}
@keyframes pip-grey {
  0%   { background: var(--off-white); filter: none; }
  20%  { background: #d0d0d0;          filter: grayscale(.7); }
  80%  { background: #d0d0d0;          filter: grayscale(.7); }
  100% { background: var(--off-white); filter: none; }
}

.pip-levelup-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 var(--black);
  animation: levelup-badge 900ms ease forwards;
  pointer-events: none;
  z-index: 10;
}
@keyframes levelup-badge {
  0%   { opacity: 0; transform: scale(.5) translateY(4px); }
  25%  { opacity: 1; transform: scale(1.2) translateY(-2px); }
  60%  { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(.8) translateY(-4px); }
}

/* ── POKÉDEX — estado visto ─────────────────────────────────────────────────── */
.dex-entry--seen { cursor: pointer; }
.dex-entry--seen:hover  { transform: translate(-1px,-1px); box-shadow: var(--shadow-sm); }

.dex-entry__sprite--seen {
  filter: brightness(.15) grayscale(1);
}

/* ── POKÉDEX — vista cuadrícula (#dex-list.dex-list--grid) ──────────────────── */
/* Filas de 3 cuadrados: número arriba a la izquierda, sprite escalado al hueco
   libre del cuadrado y nombre al pie. Tipos y flecha ocultos. */
.dex-list--grid .dex-gen-entries {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}

.dex-list--grid .dex-entry {
  position: relative;
  flex-direction: column;
  gap: 2px;
  aspect-ratio: 1 / 1;
  padding: 14px 4px 5px;
  container-type: size;
}

.dex-list--grid .dex-entry__num {
  position: absolute;
  top: 4px;
  left: 4px;
  width: auto;
  font-size: 8px;
  line-height: 8px;
}

.dex-list--grid .dex-entry__sprite-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: auto;
}

.dex-list--grid .dex-entry__sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dex-list--grid .dex-entry__silhouette {
  font-size: 30cqmin;
}

.dex-list--grid .dex-entry__info {
  flex: none;
  width: 100%;
  align-items: center;
}

/* Press Start 2P solo se ve nítida a múltiplos de 8px; a 6px se emborrona.
   line-height en px entero para que overflow:hidden no recorte los glifos. */
.dex-list--grid .dex-entry__name {
  max-width: 100%;
  font-size: 8px;
  line-height: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dex-list--grid .dex-entry__types,
.dex-list--grid .dex-entry__arrow {
  display: none;
}

.dex-list--grid .dex-entry__shiny {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 10px !important;
  height: 10px !important;
}

/* ── POKEBALL SPIN BUTTON ───────────────────────────────────────────────────── */
.pokeball-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}
.pokeball-spin {
  animation: pokeball-spin 1.4s linear infinite;
}
@keyframes pokeball-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── BOTÓN ATRÁS — cuadrado con icono de flecha, posicionado a la izquierda ─── */
.screen-header__back {
  position: absolute;
  left: var(--sp-md);
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  background: transparent;
  border: none;
  box-shadow: none;
}
.screen-header__back:hover,
.screen-header__back:active {
  background: transparent;
  border: none;
  box-shadow: none;
  transform: none;
}
.screen-header__back svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── HEADER CON TÍTULO CENTRADO ──────────────────────────────────────────────── */
.screen-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: var(--border);
  flex-shrink: 0;
  min-height: 44px;
  background: var(--red);
}
.screen-header__title {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: white;
  text-align: center;
}
.screen-header__extra {
  position: absolute;
  right: var(--sp-md);
  font-family: var(--font-pixel);
  font-size: 7px;
  color: rgba(255,255,255,.7);
}

/* ── PATH PROGRESS — bolitas de progreso del camino elegido ─────────────────── */
.path-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 6px var(--sp-md);
  flex-shrink: 0;
}

.path-progress__step {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--off-white);
  border: 2px solid var(--grey-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 300ms ease, background 300ms ease;
}
.path-progress__step--done {
  border-color: var(--green);
  background: #eafaf0;
}

.path-progress__step--current {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(74,144,226,.25);
}

.path-progress__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
}
.path-progress__step--done .path-progress__icon { opacity: .35; }

.path-progress__check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--green-dark);
  text-shadow: 1px 1px 0 rgba(255,255,255,.6);
}

.path-progress__line {
  width: 18px;
  height: 3px;
  background: var(--grey-light);
  flex-shrink: 0;
  transition: background 300ms ease;
}
.path-progress__line--done {
  background: var(--green);
}

/* ── Indicador de pokemon ya capturado junto a la barra de HP del rival ─────── */
.combat-hud__caught-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--black);
  background: linear-gradient(to bottom, var(--red) 50%, #fff 50%);
  position: relative;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Línea central horizontal */
.combat-hud__caught-dot::before {
  content: '';
  position: absolute;
  left: -1px;
  right: -1px;
  top: calc(50% - 0.75px);
  height: 1.5px;
  background: var(--black);
}

/* Botón central */
.combat-hud__caught-dot::after {
  content: '';
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--black);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ── EXP BAR — barra de experiencia bajo la barra de HP en el team bar ──────── */
.combat-team-pip__exp-bar {
  width: 100%;
  height: 3px;
  background: var(--grey-light);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.combat-team-pip__exp-fill {
  height: 100%;
  background: var(--blue);
  /* sin transición: se actualiza al instante, sin animación */
}

/* ── HELD ITEM ICON — objeto equipado en la fila del equipo de ruta ─────────── */
.held-item-icon {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--grey-light);
  border-radius: var(--radius-sm);
  background: var(--off-white);
}
.held-item-icon--empty {
  cursor: default;
  border-color: transparent;
  background: transparent;
}
.held-item-icon img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  object-fit: contain;
}
.held-item-icon__fallback {
  font-size: 18px;
  line-height: 1;
}
.held-item-tooltip {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-pixel);
  font-size: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 160px;
  z-index: 1000;
  pointer-events: none;
  line-height: 1.8;
  text-align: left;
}
.held-item-tooltip strong { color: var(--yellow); }

/* Variante usada por _renderTeamBar — se añade a document.body en
   posición fija calculada en JS, para evitar el recorte de
   overflow:hidden de .screen--adventure (sección 22.1 del README) */
.held-item-tooltip--floating {
  position: fixed;
}

/* Badge del ataque activo en la fila de equipo (selección de ruta) */
.route-move-badge {
  font-size: 7px;
  padding: 3px 7px;
  flex-shrink: 0;
  align-self: center;
}

@media (hover: none) {
  .held-item-tooltip--floating { display: none !important; }
}

/* ── Estilos específicos de móvil (max-width coincide con --screen-max del juego) ── */
@media (max-width: 480px) {
  /* ── Combat log — absorbe el espacio sobrante para que acciones + equipo
     queden juntos en la parte inferior sin hueco entre ellos. */
  /* .combat-log {
    margin-top: auto;
  } */

  /* ── Combat team bar ────────────────────────────────────────────────────────
     Altura fija con scroll: no encoge/crece al aparecer/desaparecer elementos.
     Las filas de pip se reducen al tamaño de las filas de ruta (sprite 36px). */
  .combat-team-bar {
    flex: 0 0 196px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    padding: 4px 8px;
  }

  /* Pip compacto: flex-shrink:0 impide que se compriman cuando hay muchos pokemon */
  .combat-team-pip {
    flex-shrink: 0;
    gap: 6px;
    padding: 3px 6px;
  }
  .combat-team-pip__sprite {
    width: 36px;
    height: 36px;
  }
  .combat-team-pip__hp-bar {
    height: 8px;
  }
  .combat-team-pip__level,
  .combat-team-pip__hp-nums {
    font-size: 7px;
  }
  .combat-team-pip__exp-bar {
    height: 2px;
    margin-top: 1px;
  }
  .combat-team-pip__item-slot {
    width: 18px;
    height: 18px;
  }
  .combat-team-pip__item-slot img {
    width: 14px;
    height: 14px;
  }

  /* Badge del ataque → círculo de color del tipo (sin texto) */
  .route-move-badge {
    width: 14px;
    height: 14px;
    min-width: 14px;
    padding: 0;
    font-size: 0;
    line-height: 0;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    align-self: center;
  }

  /* Cards de preparación BF — barra de vida acortada para que la bola quede al lado */
  .bf-prep-hp-wrap {
    flex: 0 0 45% !important;
  }

  /* Cards de preparación BF — padding más ajustado */
  .bf-reorg-card {
    padding: 7px 10px !important;
    gap: 8px !important;
  }
}

/* ── Compendio: tabla defensiva de tipos ────────────────────────────────── */
.tc-card {
  border-radius: var(--radius-sm);
  border: 2px solid var(--grey-light);
  background: var(--off-white);
  overflow: hidden;
  margin-bottom: 10px;
}

.tc-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--white);
  border-bottom: 2px solid var(--grey-light);
}

.tc-card__defender-badge {
  font-size: 13px;
  padding: 4px 18px;
}

.tc-card__defender-label {
  flex: 1;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--grey);
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.7;
  text-align: center;
}

.tc-card__table {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.tc-col {
  padding: 8px 10px;
  border-right: 1px solid var(--grey-light);
}
.tc-col:last-child { border-right: none; }

.tc-col__head {
  font-family: var(--font-pixel);
  font-size: 7px;
  text-align: center;
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--grey-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tc-col--weak   .tc-col__head { color: #c62828; }
.tc-col--resist .tc-col__head { color: #2e7d32; }
.tc-col--immune .tc-col__head { color: #555; }

.tc-col__body {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-top: 2px;
}

.tc-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
}

.tc-atk-badge {
  font-size: 7px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.tc-mult {
  font-family: var(--font-pixel);
  font-size: 8px;
  font-weight: bold;
  flex-shrink: 0;
}
.tc-mult--weak   { color: #c62828; }
.tc-mult--super  { color: #7b0000; }
.tc-mult--resist { color: #2e7d32; }
.tc-mult--ultra  { color: #1565c0; }
.tc-mult--immune { color: #777; }

.tc-none {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--grey-light);
  display: block;
  text-align: center;
  padding-top: 4px;
}

.tc-type-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  transition: transform 0.12s, box-shadow 0.12s;
}
.tc-type-btn:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow-sm);
}
.tc-type-btn.tc-selected {
  outline: 2px solid var(--grey-dark);
  outline-offset: 1px;
}

.tc-type-btn__badge {
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 0;
  white-space: nowrap;
  border: none;
}

.tc-type-btn__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
