/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* BODY */
body {
  font-family: 'Segoe UI', sans-serif;
  background: #0d0d0d;
  color: white;
}

/* HEADER */
.header {
  background: linear-gradient(90deg, #000000, #1a1a1a);
  padding: 20px;
  text-align: center;
  border-bottom: 2px solid #d4af37;
}

.header h1 {
  color: #d4af37;
  letter-spacing: 2px;
}

/* CONTENEDOR */
.container {
  max-width: 900px;
  margin: auto;
  padding: 20px;
}

/* BUSCADOR */
.search-box {
  background: #1a1a1a;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #d4af37;
  margin-bottom: 20px;
  text-align: center;
}

.search-box h2 {
  margin-bottom: 15px;
  color: #d4af37;
}

.search-box input {
  padding: 10px;
  width: 60%;
  border: none;
  border-radius: 5px;
  margin-right: 10px;
  outline: none;
}

.search-box textarea {
  width: 100%;
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 10px;
  border: none;
  border-radius: 6px;
  outline: none;
  resize: vertical;
}

.search-box button {
  padding: 10px 20px;
  background: #d4af37;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s;
}

.search-box button:hover {
  background: #b8962e;
}

#deckCompareSection input,
#duelPlannerSection textarea {
  display: block;
  width: 100%;
  margin: 0 0 12px 0;
}

#deckCompareSection button,
#duelPlannerSection button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

#deckCompareResultado,
#duelPlannerResultado {
  margin-top: 14px;
}

/* RESULTADOS */
.resultado {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* BATALLA */
.battle {
  background: #1a1a1a;
  border-left: 5px solid #d4af37;
  padding: 15px;
  border-radius: 8px;
  transition: 0.3s;
}

.battle:hover {
  transform: scale(1.02);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.battle h3 {
  margin-bottom: 5px;
  color: #d4af37;
}

.battle p {
  font-size: 14px;
  color: #ccc;
}
.player-card {
  background: #1a1a1a;
  padding: 15px;
  border: 1px solid gold;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: center;
}

.player-history {
  font-size: 13px;
  color: #d7d7d7;
  margin-top: 6px;
}

.history-card {
  background: #111;
  border: 2px solid #d4af37;
  border-radius: 12px;
  padding: 15px;
  margin-top: 20px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.history-header h2 {
  color: #d4af37;
}

.history-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  background: #1a1a1a;
  border: 1px solid #2b2b2b;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 15px;
}

.history-pagination button {
  padding: 8px 12px;
  min-height: 34px;
  line-height: 1.2;
  border: none;
  border-radius: 6px;
  background: #d4af37;
  color: black;
  font-weight: bold;
  cursor: pointer;
}

.history-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.history-pagination span {
  color: #fff;
  font-weight: 600;
  margin: 0 4px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.deck {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  margin-top: 10px;
}

.filtros {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: center;
}

.filtros button {
  padding: 8px 15px;
  border: none;
  background: #d4af37;
  cursor: pointer;
  border-radius: 5px;
  font-weight: bold;
}
.btn-copy {
  margin-top: 10px;
  padding: 8px 12px;
  background: #d4af37;
  border: none;
  border-radius: 6px;
  color: black;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

.btn-copy:hover {
  background: #b8962e;
  transform: scale(1.05);
}
.acciones {
  display: flex;
  align-items: center; /* ðŸ”¥ CLAVE */
  gap: 10px;
  margin-top: 10px;
}
.btn-link {
  margin-top: 10px;
  padding: 8px 12px;
  background: #00c853;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
}
.btn-copy,
.btn-link {
  height: 40px; /* ðŸ”¥ misma altura */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ðŸ”¥ EVO (brillo violeta) */
.card.evo {
  border: 2px solid #a855f7;
  box-shadow: 0 0 10px #a855f7;
}

/* ðŸ”¥ HERO (borde dorado) */
.card.hero {
  border: 2px solid gold;
  box-shadow: 0 0 10px gold;
}
/*BATTLE*/
.battle-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.battle-table th,
.battle-table td {
  padding: 10px;
  text-align: center;
  border-bottom: 1px solid #ddd;
}

.victory {
  color: #2ecc71;
  font-weight: bold;
}

.defeat {
  color: #e74c3c;
  font-weight: bold;
}
.btn-clash {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 12px;
  background: #ffcc00;
  color: black;
  font-weight: bold;
  border-radius: 6px;
  text-decoration: none;
}

.duel-match {
  margin-top: 10px;
}
.duel-group {
  border: 2px solid gold;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 10px;
  background: #0f0f0f;
}

.duel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.player, .opponent {
  width: 40%;
}

.vs {
  width: 20%;
  text-align: center;
  font-size: 20px;
}
.filtros {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 15px 0;
}

.filtros button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #d4af37;
  color: black;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

.filtros button:hover {
  transform: scale(1.05);
}

/* ðŸ“± MOBILE */
@media (max-width: 600px) {
  .filtros {
    flex-direction: column;
    align-items: stretch;
  }

  .filtros button {
    width: 100%;
    font-size: 14px;
  }
}
.filtros button.active {
  background: #fff;
  color: #000;
}
.stats-card h3 {
  margin-top: 15px;
  color: gold;
}

.stats-card img {
  margin: 5px;
}
/* ===============================
   âš”ï¸ COMPARADOR
=============================== */
.compare-box {
  border: 2px solid #d4af37;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
  background: #111;
  text-align: center;
}

.compare-box h2 {
  color: #d4af37;
  margin-bottom: 10px;
}

.compare-box input {
  padding: 10px;
  margin: 5px;
  border-radius: 6px;
  border: none;
  width: 200px;
  max-width: 100%;
}

.compare-box button {
  padding: 10px 15px;
  border: none;
  border-radius: 6px;
  background: #d4af37;
  color: black;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

.compare-box button:hover {
  transform: scale(1.05);
}

/* ===============================
   ðŸ“Š RESULTADO COMPARACIÃ“N
=============================== */
.compare-card {
  border: 2px solid #d4af37;
  padding: 15px;
  margin-top: 20px;
  border-radius: 12px;
  background: #111;
  text-align: center;
}

.duel-plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.duel-plan-block {
  background: #1a1a1a;
  border: 1px solid #d4af37;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  margin-top: 12px;
}

.duel-plan-deck {
  margin-top: 10px;
}

.duel-plan-deck p {
  margin-bottom: 6px;
  color: #d4af37;
}

.card-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #222;
  border: 1px solid #d4af37;
  color: #fff;
  font-size: 11px;
}

.compare-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.compare-row div {
  width: 40%;
}

.vs {
  width: 20%;
  font-size: 22px;
  font-weight: bold;
  color: #d4af37;
}

/* ===============================
   ðŸ“± RESPONSIVE
=============================== */
@media (max-width: 600px) {

  .compare-row {
    flex-direction: column;
    gap: 10px;
  }

  .compare-row div {
    width: 100%;
  }

  .vs {
    width: 100%;
  }

  .compare-box input {
    width: 100%;
  }

  .duel-plan-grid {
    grid-template-columns: 1fr;
  }
}
.ranking-card {
  margin-top: 20px;
  padding: 15px;
  border: 2px solid gold;
  border-radius: 10px;
  background: #111;
}

/* ===============================
ðŸ“„ TABLA BATTLE LOG RESPONSIVE
=============================== */

.tabla-card {
  background: #111;
  border: 2px solid gold;
  border-radius: 12px;
  padding: 15px;
  margin-top: 20px;
  overflow: hidden;
}

.tabla-card h2 {
  text-align: center;
  margin-bottom: 10px;
}

/* ðŸ”¥ contenedor scroll horizontal */
.tabla-card table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px; /* clave para scroll */
}

/* ðŸ‘‡ scroll en mobile */
.tabla-card {
  overflow-x: auto;
}

/* columnas */
.tabla-card th,
.tabla-card td {
  padding: 10px;
  text-align: center;
  font-size: 14px;
}

/* header */
.tabla-card th {
  background: #222;
  color: gold;
}

/* filas */
.tabla-card tr:nth-child(even) {
  background: #1a1a1a;
}

/* resultado */
td.win {
  color: #00ff88;
  font-weight: bold;
}

td.lose {
  color: #ff4d4d;
  font-weight: bold;
}

/* link deck */
.tabla-card a {
  color: #00aaff;
  text-decoration: none;
  font-weight: bold;
}

/* ===============================
ðŸ”¥ DECKS RESPONSIVE
=============================== */

.decks-card {
  background: #111;
  border: 2px solid gold;
  border-radius: 12px;
  padding: 15px;
  margin-top: 20px;
}

#topCards .decks-card,
#topDecks .decks-card {
  width: 100%;
}

#topCards .decks-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 18px;
}

#topCards .decks-card h2 {
  flex: 0 0 100%;
}

.deck-item {
  margin-bottom: 15px;
}

#topCards .deck-item,
#topDecks .deck-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#topCards .deck-item {
  width: 150px;
  margin-bottom: 0;
}

#topCards .deck-cards {
  justify-content: center;
  flex-wrap: nowrap;
}

/* cartas */
.deck-cards {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
}

.deck-cards img {
  width: 70px;
}

/* info */
.deck-info {
  text-align: center;
  margin-top: 5px;
}

#topCards .deck-info,
#topDecks .deck-info {
  width: 100%;
}

/* ===============================
ðŸ“± MOBILE
=============================== */

@media (max-width: 768px) {

  /* tabla */
  .tabla-card th,
  .tabla-card td {
    font-size: 12px;
    padding: 6px;
  }

  /* cartas mÃ¡s chicas */
  .deck-cards img {
    width: 50px;
  }

  /* tÃ­tulos */
  h2 {
    font-size: 18px;
  }

  /* botones filtros */
  .filtros {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
  }

  .filtros button {
    font-size: 12px;
    padding: 6px 10px;
  }

  /* inputs */
  input {
    width: 100%;
    margin-bottom: 10px;
  }

  button {
    width: 100%;
  }
}

/* ===============================
   ðŸŽ´ CARTAS (NUEVO SISTEMA)
=============================== */

/* contenedor */
.deck {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  justify-items: center;
}

/* imagen base */
.deck img {
  width: 100%;
  max-width: 95px;
  height: auto;
  border-radius: 8px;
  transition: transform 0.2s ease;
}

/* clase principal */
.card {
  width: 100%;
  max-width: 95px;
  border-radius: 10px;
  margin: 4px;
  transition: transform 0.2s ease;
}

/* hover */
.card:hover {
  transform: scale(1.1);
}

/* EVO */
.card.evo {
  border: 2px solid #a855f7;
  box-shadow: 0 0 12px #a855f7;
}

/* HERO */
.card.hero {
  border: 2px solid gold;
  box-shadow: 0 0 12px gold;
}
@media (max-width: 768px) {
  .deck {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    justify-items: center;
  }

  .deck img {
   width: 70px;
}

.card {
  width: 70px;
}

  .battle {
    padding: 10px;
  }

  .container {
    padding: 10px;
  }

  .search-box input {
    width: 100%;
    margin-bottom: 10px;
  }

  .search-box button {
    width: 100%;
  }

  .duel-row {
    flex-direction: column; /* ðŸ‘ˆ CLAVE */
    align-items: center;
    gap: 10px;
  }

  .player,
  .opponent {
    width: 100%;
    text-align: center;
  }

  .vs {
    margin: 10px 0;
    font-size: 18px;
  }
}
/* ===============================
   ðŸ”¥ RESULTADOS PRO
=============================== */

.battle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.battle-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.battle-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #2a2a2a;
  border: 1px solid #d4af37;
  color: #d4af37;
  font-size: 12px;
  font-weight: 700;
}

.victory {
  color: #00ff88;
  font-weight: bold;
}

.defeat {
  color: #ff4d4d;
  font-weight: bold;
}

.battle-extra {
  font-size: 12px;
  color: #aaa;
}

.battle-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #333;
  font-size: 12px;
  color: #bfbfbf;
}

/* ===============================
   ðŸ“± MOBILE FIX FINAL
=============================== */

@media (max-width: 768px) {

  .duel-row {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .player, .opponent {
    width: 100%;
    text-align: center;
  }

  .vs {
    margin: 8px 0;
  }

}
.duel-group {
  margin-bottom: 20px;
}

.duel-battle {
  margin-top: 10px;
  padding: 10px;
  border-top: 1px solid #333;
}

.duel-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px;
}
.score {
  font-weight: bold;
  margin: 0 10px;
  color: #FFD700;
}

.deck-label {
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: bold;
  color: #d4af37;
  text-align: center;
}
