/* ===== Inazuma Eleven Roguelike — estilos (identidad visual original) ===== */

:root {
  --bg: #0d1512;
  --bg-alt: #101c17;
  --panel: #142019;
  --panel-2: #1a2921;
  --border: #26382e;
  --text: #eaf3ec;
  --text-dim: #93a89c;
  --accent: #3ea6ff;
  --accent-2: #ffb020;
  --danger: #ff5c5c;
  --success: #33c17d;

  --fuego: #ff6b45;
  --bosque: #4caf50;
  --viento: #29c7c7;
  --montana: #b98a55;

  --radius: 12px;
  --radius-sm: 8px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f0e8;
  --bg-alt: #ffffff;
  --panel: #ffffff;
  --panel-2: #ece7d9;
  --border: #d9d2bf;
  --text: #1c2620;
  --text-dim: #5c6a60;
  --accent: #1868c9;
  --accent-2: #b16a00;
  --danger: #c8382f;
  --success: #1c8a56;

  color-scheme: light;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-weight: 400;
}

body {
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  min-height: 100vh;
  touch-action: manipulation;
}

h1, h2, h3, h4 {
  font-family: 'Oswald', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 0.4em;
  line-height: 1.1;
}

button, input, select { font-family: inherit; }
a { color: var(--accent); }

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--accent-2);
  color: #1a1200;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  z-index: 999;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ===== Header / Footer ===== */

.site-header {
  position: relative;
  padding: calc(18px + var(--safe-t)) 16px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.theme-toggle {
  position: absolute;
  top: calc(10px + var(--safe-t));
  right: calc(12px + var(--safe-r));
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.theme-toggle:hover { background: var(--panel); }
.site-header h1 {
  font-size: clamp(1.7rem, 7vw, 2.6rem);
  text-transform: uppercase;
  color: var(--text);
}
.site-header h1 .hl { color: var(--accent); }
.tagline {
  color: var(--text-dim);
  margin: 0;
  font-size: clamp(0.85rem, 2.6vw, 1rem);
}

.how-to-play {
  max-width: 720px;
  margin: 28px auto;
  padding: 0 16px;
}
.how-to-play h2 {
  font-size: 1.4rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.how-to-play ol { padding-left: 1.2em; color: var(--text-dim); line-height: 1.55; }
.how-to-play li { margin-bottom: 0.6em; }
.how-to-play strong { color: var(--text); }

.site-footer {
  text-align: center;
  padding: 18px 16px calc(24px + var(--safe-b));
  color: var(--text-dim);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.site-footer strong { color: var(--text); }

/* ===== App shell ===== */

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  min-height: 40vh;
}

.screen { animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.panel-title {
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 10px;
  text-transform: uppercase;
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: #06202f; border-color: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #2b0000; }
.btn-outline { background: transparent; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

/* ===== Type badges (sin emoji: marca de letra + color) ===== */

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.type-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
}
.type-mark {
  display: none;
}
.media-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.3);
}
.type-fuego   { background: rgba(255,107,69,0.14); color: var(--fuego); border-color: var(--fuego); }
.type-bosque  { background: rgba(76,175,80,0.16);  color: var(--bosque); border-color: var(--bosque); }
.type-viento  { background: rgba(41,199,199,0.16); color: var(--viento); border-color: var(--viento); }
.type-montana { background: rgba(185,138,85,0.2);  color: var(--montana); border-color: var(--montana); }

.type-bg-fuego   { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--fuego) 60%, #fff), var(--fuego)); }
.type-bg-bosque  { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--bosque) 60%, #fff), var(--bosque)); }
.type-bg-viento  { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--viento) 60%, #fff), var(--viento)); }
.type-bg-montana { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--montana) 60%, #fff), var(--montana)); }

.icon-inline { width: 1em; height: 1em; vertical-align: -0.15em; fill: currentColor; }

/* ===== Player cards ===== */

.card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .card-grid { grid-template-columns: 1fr 1fr; } }

/* ===== Vista de plantilla en el campo ===== */

.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-title-row h3 { margin: 0; }
.view-toggle { display: flex; gap: 3px; background: var(--bg-alt); border-radius: 999px; padding: 3px; flex-shrink: 0; }
.view-toggle-wrap { flex-wrap: wrap; border-radius: var(--radius-sm); width: 100%; }
.btn-tiny {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-tiny.active { background: var(--accent); color: #06202f; }

.pitch {
  position: relative;
  background: repeating-linear-gradient(0deg, #12241a, #12241a 26px, #16301f 26px, #16301f 52px);
  border: 2px solid #244a34;
  border-radius: var(--radius);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 16px;
  min-height: 260px;
  overflow: hidden;
}
.pitch-row { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.pitch-player { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 56px; }
.pitch-player-name {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 56px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.pitch-player.fatigued .pitch-player-name { color: var(--text-dim); }
/* Filas de hasta 5 (FutDraft, 11 jugadores): jugadores más estrechos para
   que quepan sin amontonarse en una pantalla de móvil. */
.pitch-11 { min-height: 380px; gap: 10px; padding: 14px 6px; }
.pitch-11 .pitch-row { gap: 8px; }
.pitch-11 .pitch-player { width: 44px; }
.pitch-11 .pitch-player-name { font-size: 0.56rem; max-width: 44px; }
.pitch-11 .avatar { width: 32px; height: 32px; }
.pitch-empty-slot {
  width: 32px; height: 32px;
  border: 2px dashed rgba(255,255,255,0.28);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.35);
  font-size: 0.9rem;
}
/* FutDraft: cambios entre titulares y banquillo */
.futdraft-swappable { cursor: pointer; }
.futdraft-swappable .avatar { transition: box-shadow 0.15s ease; }
.futdraft-swappable:hover .avatar,
.futdraft-swappable:active .avatar { box-shadow: 0 0 0 2px var(--accent) inset; }
.pitch-player.selected .avatar { box-shadow: 0 0 0 3px var(--accent-2); border-radius: 50%; }
.futdraft-captain-badge {
  position: absolute; top: -4px; right: 6px; font-size: 0.85rem; line-height: 1; z-index: 2;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.6));
}
.futdraft-out-of-position .avatar { box-shadow: 0 0 0 2px var(--danger) inset; }
.pitch-center-line { position: absolute; left: 8%; right: 8%; top: 50%; height: 1px; background: rgba(255,255,255,0.18); }
.pitch-center-circle {
  position: absolute; left: 50%; top: 50%; width: 70px; height: 70px;
  border: 1px solid rgba(255,255,255,0.18); border-radius: 50%;
  transform: translate(-50%, -50%);
}

.player-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s ease, transform 0.08s ease;
  color: var(--text);
  width: 100%;
}
.player-card:active { transform: scale(0.98); }
.player-card:hover { border-color: var(--accent); }
.player-card.selected { border-color: var(--accent-2); border-width: 2px; }
.player-card.disabled { opacity: 0.5; cursor: not-allowed; }
.player-card.fatigued { border-style: dashed; }

.player-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.player-head-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.player-name { font-size: 1.05rem; font-weight: 600; }
.player-original { font-size: 0.72rem; color: var(--text-dim); }

.avatar {
  position: relative;
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15);
}
.avatar-initials {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #06110c;
  text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}
.avatar-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  display: block;
  /* Si tus sprites son pixel art, descomenta la siguiente línea para que no
     salgan borrosos al escalarlos en pantallas pequeñas/grandes:
  image-rendering: pixelated; */
}
.avatar-pos-badge {
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  width: 22px;
  line-height: 0;
}
.avatar-pos-badge img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}

.stat-bars {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 8px;
  font-size: 0.8rem;
}
.stat-label { color: var(--text-dim); white-space: nowrap; }
.stat-bar-track {
  background: var(--bg-alt);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  align-self: center;
}
.stat-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.stat-value { text-align: right; color: var(--text); }

.hissatsu-tag {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--accent-2);
  font-weight: 600;
}
.fatigue-tag { display: inline-block; margin-top: 6px; font-size: 0.75rem; color: var(--danger); }

/* ===== Map ===== */

.map-wrap { position: relative; overflow-x: auto; padding: 10px 4px 20px; }
.map-rows {
  display: flex;
  flex-direction: column-reverse;
  gap: 34px;
  position: relative;
  min-width: 260px;
}
.map-row { display: flex; justify-content: center; gap: 22px; position: relative; z-index: 2; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }

.node-btn-wrap { position: relative; }
.node-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
  transition: transform 0.1s ease, border-color 0.15s ease;
  flex-shrink: 0;
  padding: 14px;
}
.node-btn svg { width: 100%; height: 100%; }
.node-btn:active { transform: scale(0.94); }
.node-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.node-btn.available { border-color: var(--accent-2); color: var(--accent-2); animation: pulse 1.6s infinite; }
.node-btn.current { border-color: var(--accent); color: var(--accent); }
.node-btn.cleared { opacity: 0.5; border-color: var(--success); color: var(--success); }
.node-btn.boss { width: 66px; height: 66px; border-color: var(--danger); color: var(--danger); padding: 16px; }

@keyframes pulse {
  0%, 100% { border-color: var(--accent-2); }
  50% { border-color: var(--text); }
}

.node-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  white-space: nowrap;
  color: var(--text-dim);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 26px;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { width: 16px; height: 16px; }

/* ===== Match screen ===== */

.match-scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.score-side { text-align: center; flex: 1; min-width: 0; }
.score-name { font-size: 0.85rem; color: var(--text-dim); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-num { font-size: 2.4rem; font-family: 'Oswald', sans-serif; line-height: 1; }
.team-shield { width: 34px; height: 34px; object-fit: contain; display: block; margin: 0 auto 4px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
.team-shield-inline { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
.bracket-shield { width: 18px; height: 18px; object-fit: contain; vertical-align: middle; margin-right: 4px; border-radius: 3px; }
.score-vs { font-size: 0.9rem; color: var(--text-dim); padding: 0 8px; }
.turn-indicator {
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.9rem;
}

.meter-wrap { margin: 10px 0 16px; }
.meter-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-dim); margin-bottom: 4px; }
.meter-track { height: 14px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.meter-fill { height: 100%; background: var(--accent); transition: width 0.35s ease; }
.meter-fill.full { background: var(--accent-2); }

.field {
  position: relative;
  background: repeating-linear-gradient(0deg, #12241a, #12241a 26px, #16301f 26px, #16301f 52px);
  border: 2px solid #244a34;
  border-radius: var(--radius);
  padding: 22px 12px;
  text-align: center;
  margin-bottom: 14px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}
.field-event { font-size: 1.15rem; font-weight: 600; color: var(--text); }
.field-icon { font-size: 2.2rem; line-height: 1; }
.field.goal, .field.save, .field.defense, .field.block { animation-duration: 0.6s; animation-timing-function: ease; }
.field.goal { animation-name: goalFlash; }
@keyframes goalFlash {
  0% { background-color: #16301f; }
  30% { background-color: #1f6b41; }
  100% { background-color: #16301f; }
}
.field.save { animation-name: saveFlash; }
@keyframes saveFlash {
  0% { background-color: #16301f; }
  30% { background-color: #1f4a6b; }
  100% { background-color: #16301f; }
}
.field.defense { animation-name: defenseFlash; }
@keyframes defenseFlash {
  0% { background-color: #16301f; }
  30% { background-color: #6b4a1f; }
  100% { background-color: #16301f; }
}
.field.goal .field-icon { animation: iconPopGoal 0.6s ease; }
@keyframes iconPopGoal {
  0% { opacity: 0; transform: scale(0.3) translateY(10px) rotate(-15deg); }
  45% { opacity: 1; transform: scale(1.3) translateY(-4px) rotate(8deg); }
  70% { transform: scale(0.95) rotate(-3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.field.save .field-icon { animation: iconPopSave 0.5s ease; }
@keyframes iconPopSave {
  0% { opacity: 0; transform: scale(0.5) translateX(24px); }
  50% { opacity: 1; transform: scale(1.2) translateX(-4px); }
  100% { opacity: 1; transform: scale(1) translateX(0); }
}
.field.defense .field-icon,
.field.block .field-icon { animation: iconPopDefense 0.45s ease; }
@keyframes iconPopDefense {
  0% { opacity: 0; transform: scale(0.6); }
  40% { opacity: 1; transform: scale(1.25); }
  60% { transform: scale(0.9) translateX(-4px); }
  80% { transform: scale(1.05) translateX(3px); }
  100% { opacity: 1; transform: scale(1) translateX(0); }
}
.field.save .field-event,
.field.defense .field-event,
.field.block .field-event { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.action-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; }
.action-btn { flex-direction: column; font-size: 0.88rem; min-height: 64px; }
.action-btn small { display: block; font-size: 0.68rem; color: var(--text-dim); font-weight: 500; }
.btn-primary small { color: #06202f; opacity: 0.7; }

.penalty-panel h3 { margin-bottom: 4px; }
.penalty-goal {
  position: relative;
  max-width: 320px;
  margin: 14px auto 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.penalty-goal-img { width: 100%; display: block; }
.penalty-zones { position: absolute; inset: 0; display: flex; }
.penalty-zone {
  flex: 1;
  background: rgba(255,255,255,0.02);
  border: none;
  border-right: 1px dashed rgba(255,255,255,0.25);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease;
}
.penalty-zone:last-child { border-right: none; }
.penalty-zone:hover, .penalty-zone:active { background: rgba(78,205,196,0.25); }

/* ===== Fichaje de Bolas (gachapon) ===== */

.gacha-machine { max-width: 220px; margin: 4px auto 0; }
.gacha-dome {
  position: relative;
  height: 130px;
  border-radius: 50% 50% 8px 8px / 60% 60% 8px 8px;
  background: radial-gradient(circle at 35% 25%, rgba(255,255,255,0.25), rgba(78,205,196,0.15) 45%, rgba(15,52,96,0.6) 100%);
  border: 3px solid #16213e;
  overflow: hidden;
}
.gacha-ball {
  position: absolute;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--c2), var(--c1) 70%);
  box-shadow: inset 0 -3px 4px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.4);
}
.gacha-body {
  position: relative;
  height: 42px;
  background: linear-gradient(#e94560, #b3283f);
  border: 3px solid #16213e;
  border-top: none;
  border-radius: 0 0 10px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gacha-slot { width: 46px; height: 10px; background: #16213e; border-radius: 4px; }
.gacha-crank {
  position: absolute;
  right: -14px;
  top: 50%;
  width: 28px; height: 28px;
  transform-origin: 50% 50%;
  margin-top: -14px;
}
.gacha-crank-arm { position: absolute; left: 50%; top: 50%; width: 4px; height: 14px; background: #cfd8dc; transform: translate(-50%, -100%); border-radius: 2px; }
.gacha-crank-knob { position: absolute; left: 50%; top: 0; width: 12px; height: 12px; margin-left: -6px; margin-top: -6px; border-radius: 50%; background: #e94560; border: 2px solid #cfd8dc; }

.gacha-machine.spinning .gacha-dome { animation: gachaShake 0.28s ease-in-out infinite; }
.gacha-machine.spinning .gacha-ball { animation: gachaBallJiggle 0.28s ease-in-out infinite; }
.gacha-machine.spinning .gacha-ball:nth-child(2) { animation-delay: 0.05s; }
.gacha-machine.spinning .gacha-ball:nth-child(3) { animation-delay: 0.1s; }
.gacha-machine.spinning .gacha-ball:nth-child(4) { animation-delay: 0.15s; }
.gacha-machine.spinning .gacha-ball:nth-child(5) { animation-delay: 0.2s; }
.gacha-machine.spinning .gacha-ball:nth-child(6) { animation-delay: 0.08s; }
.gacha-machine.spinning .gacha-crank { animation: gachaCrankSpin 0.5s linear infinite; }
@keyframes gachaShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-3px) rotate(-1deg); }
  75% { transform: translateX(3px) rotate(1deg); }
}
@keyframes gachaBallJiggle {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2px, -3px); }
}
@keyframes gachaCrankSpin {
  to { transform: rotate(360deg); }
}

.gacha-result { animation: fadeIn 0.4s ease; }

.log-panel {
  max-height: 130px;
  overflow-y: auto;
  font-size: 0.82rem;
  color: var(--text-dim);
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 10px;
}
.log-panel p { margin: 3px 0; }

/* ===== Línea temporal del partido (FutDraft) ===== */
.futdraft-timeline {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.futdraft-timeline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.futdraft-timeline-row:last-child { border-bottom: none; }
/* Goles del rival en espejo: toda la fila (minuto, escudo, avatar, texto)
   se pega a la derecha en vez de a la izquierda, para distinguirlos de un
   vistazo de los tuyos sin tener que leer el nombre del equipo. */
.futdraft-timeline-row-opp {
  flex-direction: row-reverse;
  text-align: right;
}
.futdraft-timeline-minute {
  font-family: var(--font-mono, monospace);
  color: var(--accent-2);
  font-weight: 700;
  min-width: 2.6em;
  text-align: right;
}
.futdraft-timeline-shield { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.futdraft-timeline-row .avatar { width: 22px; height: 22px; flex-shrink: 0; }
.futdraft-timeline-row .avatar-pos-badge { display: none; }

/* ===== Tabla de la Liga ===== */
.liga-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  white-space: nowrap;
}
.liga-table th, .liga-table td {
  padding: 5px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.liga-table th { color: var(--text-dim); font-weight: 600; }
.liga-table td:nth-child(3) { text-align: left; }
.liga-table tr.liga-you { background: var(--accent-2); color: #06202f; font-weight: 700; }
.liga-table tr.liga-you td { border-bottom-color: var(--accent-2); }
.liga-row-shield { width: 22px; height: 22px; object-fit: contain; display: block; }
.liga-form { display: inline-flex; gap: 3px; }
.liga-form-dot {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; line-height: 1; color: #fff;
}
.liga-form-win { background: var(--success, #22c55e); }
.liga-form-draw { background: var(--text-dim); color: var(--bg); }
.liga-form-loss { background: var(--danger); }
.liga-form-empty { background: transparent; border: 1px solid var(--border); }
.liga-table tr.liga-you .liga-form-draw { color: var(--bg); }

/* ===== Choice cards (training / recruit) ===== */

.choice-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.choice-card h3 { font-size: 1.05rem; color: var(--accent); margin-bottom: 4px; }
.choice-card p { color: var(--text-dim); margin: 4px 0 10px; font-size: 0.88rem; }

/* ===== Vestuario / shop ===== */

.shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.shop-item .cost { color: var(--accent-2); font-weight: 700; white-space: nowrap; text-align: right; }

.currency-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  color: var(--accent-2);
}

/* Recompensa destacada al terminar (p.ej. Liga): mucho más grande y con un
   pequeño "pop" al aparecer, para que no pase desapercibida como un simple
   currency-display más -- a petición explícita tras subir la cantidad. */
.reward-highlight {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 12px auto;
  padding: 14px 20px;
  max-width: fit-content;
  background: linear-gradient(135deg, rgba(255,209,102,0.22), rgba(255,209,102,0.06));
  border: 2px solid var(--accent-2);
  border-radius: var(--radius, 14px);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-2);
  animation: rewardHighlightPop 0.5s ease;
}
@keyframes rewardHighlightPop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

.stats-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat-tile { background: var(--bg-alt); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.stat-tile .num { font-size: 1.7rem; font-family: 'Oswald', sans-serif; color: var(--accent); }
.stat-tile .label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; }

.center-text { text-align: center; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.dim { color: var(--text-dim); }
.small { font-size: 0.85rem; }

@media (min-width: 640px) {
  .action-row { grid-template-columns: repeat(3, 1fr); }
}

/* ===== Bracket de Torneo ===== */
.bracket-panel { padding: 14px 10px; }
.bracket-tree {
  display: flex;
  align-items: stretch;
  gap: 30px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 10px 14px;
  -webkit-overflow-scrolling: touch;
}
.bracket-round-col {
  display: flex;
  flex-direction: column;
  flex: 0 0 152px;
}
.bracket-round-title {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: var(--accent-2);
  margin-bottom: 10px;
}
.bracket-pairs { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 18px; }
.bracket-pair { position: relative; display: flex; flex-direction: column; gap: 12px; }
.bracket-pair::after {
  content: '';
  position: absolute;
  right: -16px; top: 24%; bottom: 24%;
  width: 16px;
  border: 2px solid var(--accent-2);
  border-left: none;
  border-radius: 0 8px 8px 0;
  opacity: 0.55;
}
.bracket-match { display: flex; flex-direction: column; gap: 5px; position: relative; }
.bracket-team {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #06202f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bracket-team span { overflow: hidden; text-overflow: ellipsis; }
.bracket-team-blue { background: var(--accent); }
.bracket-team-gold { background: var(--accent-2); }
.bracket-team-lost { background: var(--bg-alt); color: var(--text-dim); opacity: 0.55; }
.bracket-team-winner { box-shadow: 0 0 0 2px var(--success) inset; }
.bracket-match-active .bracket-team { box-shadow: 0 0 0 2px var(--text) inset; }
.bracket-your-turn {
  text-align: center;
  font-size: 0.66rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1px;
}
.bracket-final-wrap { flex: 1; display: flex; align-items: center; }
.bracket-trophy-col { flex: 0 0 110px; align-items: center; }
.bracket-trophy-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.bracket-trophy { font-size: 2.6rem; line-height: 1; }
.bracket-trophy.is-pending { opacity: 0.3; filter: grayscale(1); }
.bracket-champion-name { font-weight: 800; color: var(--accent-2); font-size: 0.92rem; }

/* ===== Victory & Defeat Animations ===== */
.victory-animation {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  z-index: 9999;
  animation: victoryBounce 1.5s ease-out forwards;
  filter: drop-shadow(0 0 20px #FFD700);
}
@keyframes victoryBounce {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -150%) scale(1); opacity: 0; }
}

.defeat-animation {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 100px;
  z-index: 9999;
  animation: defeatShake 1s ease-out forwards;
  filter: drop-shadow(0 0 15px #FF4444);
}
@keyframes defeatShake {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); opacity: 1; }
  25% { transform: translate(-45%, -50%) rotate(-5deg); }
  50% { transform: translate(-55%, -50%) rotate(5deg); }
  75% { transform: translate(-48%, -50%) rotate(-3deg); }
}

.tournament-victory {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 9999;
  animation: trophySpinFloat 2s ease-out forwards;
}
.trophy-icon { font-size: 150px; animation: trophySpin 1.2s ease-in-out infinite; }
.victory-text {
  font-size: 48px;
  font-weight: bold;
  color: #FFD700;
  margin-top: 20px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  animation: textGlow 1s ease-in-out infinite;
}
@keyframes trophySpinFloat {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-180deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 0; }
}
@keyframes trophySpin {
  0%, 100% { transform: rotateZ(0deg); }
  50% { transform: rotateZ(10deg); }
}
@keyframes textGlow {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}
