/* ========================
   VARIÁVEIS E BASE GLOBAL
======================== */
:root {
  --corP: #2e2d2c;
  --corB: #f0f0f0;
  --cor1: #3b1208;
  --cor2: #6b2610;
  --cor3: #a34118;
  --cor4: #d98026;
  --cor5: #e2b85b;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --shadow: rgba(0, 0, 0, 0.2);
  --shadow-heavy: rgba(0, 0, 0, 0.4);
}

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
a {
  color: inherit;
  text-decoration: none;
}

body {
  font-family: "Montserrat", sans-serif;
  background: linear-gradient(135deg, var(--cor1), var(--cor2));
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--corP);
  overflow-x: hidden;
}

/* ========================
           HEADER
======================== */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  margin: 20px;
  border-radius: 15px;
  background: var(--cor3);
  box-shadow: 0 8px 25px var(--shadow);
}
.header h1 {
  color: var(--corB);
  font-size: 28px;
  font-weight: 700;
  text-shadow: 2px 2px 4px var(--shadow);
}
.logo {
  height: 60px;
  filter: drop-shadow(2px 2px 4px var(--shadow));
}

/* ========================
      CONTAINER GERAL
======================== */
.main-container {
  padding: 20px;
  min-height: calc(100vh - 200px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.btn-zerar {
    background: var(--corB);
    border-radius: 10px;
    padding: 10px;
    margin: 0 auto;
    width: 200px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 1s ;
}

.btn-zerar:hover {
    transform:translateY(-2px);
}

/* ========================
          LOADING
======================== */
.loading {
  display: none;
  text-align: center;
  padding: 40px;
  color: var(--corB);
  font-size: 16px;
}
.loading i {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

/* ========================
           PÓDIO
======================== */
.podium-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
}

.primeiro {
  order: 2;
  transform: translateY(0);
}
.segundo {
  order: 1;
  transform: translateY(25px);
}
.terceiro {
  order: 3;
  transform: translateY(25px);
}

.podium-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 16px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px var(--shadow-heavy);
}

.primeiro .podium-circle {
  width: 140px;
  height: 140px;
}

.podium-circle.gold {
  background: linear-gradient(135deg, #ffd700, #ffa500);
}
.podium-circle.silver {
  background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
}
.podium-circle.bronze {
  background: linear-gradient(135deg, #cd7f32, #b8860b);
}

.podium-circle .position {
  font-size: 32px;
  font-weight: bold;
  color: var(--corB);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.podium-circle i {
  font-size: 22px;
  color: var(--corB);
  margin-top: 5px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.podium-info {
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 5px 20px var(--shadow);
  min-width: 160px;
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

/* ========================
           TABELA
======================== */
.ranking-table-container {
  width: 100%;
  max-width: 800px;
  opacity: 0;
  transform: translateY(20px);
  background: var(--corB);
  border-radius: 15px;
  box-shadow: 0 10px 40px var(--shadow);
  transition: all 0.3s ease;
}
.ranking-table {
  width: 100%;
}

/* Cabeçalho */
.table-header {
  display: grid;
  grid-template-columns: 70px 1fr 160px;
  background: linear-gradient(135deg, var(--cor3), var(--cor4));
  color: var(--corB);
  font-weight: 600;
  font-size: 14px;
  align-items: center;
  justify-items: center;
}
.header-cell {
  width: 100%;
  padding: 16px;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}
.header-cell:last-child {
  border-right: none;
}

/* Linhas */
.table-row {
  display: grid;
  grid-template-columns: 70px 1fr 160px;
  align-items: center;
  justify-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.25s ease;
  cursor: pointer;
}
.table-row:hover {
  background: rgba(226, 184, 91, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.08);
}
.table-row.podium-row {
  background: rgba(255, 215, 0, 0.08);
}
.table-row.podium-row.first {
  background: rgba(255, 215, 0, 0.12);
}
.table-row.podium-row.second {
  background: rgba(192, 192, 192, 0.12);
}
.table-row.podium-row.third {
  background: rgba(205, 127, 50, 0.12);
}

.cell {
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.cell.name {
  justify-content: flex-start;
}
.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.player-info i {
  color: var(--cor2);
}

.position-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--corB);
  font-size: 14px;
  background: var(--cor3);
}
.position-badge.gold {
  background: linear-gradient(135deg, #ffd700, #ffa500);
}
.position-badge.silver {
  background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
}
.position-badge.bronze {
  background: linear-gradient(135deg, #cd7f32, #b8860b);
}

/* ========================
            MODAL
======================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 900;
}
.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.show {
  display: flex;
}

.modal-content {
  width: min(560px, 92vw);
  max-height: 84vh;
  overflow: hidden;
  background: #fff;
  color: #111;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  transform: scale(0.98) translateY(8px);
  opacity: 0;
  animation: modalIn 0.18s ease forwards;
}
@keyframes modalIn {
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content h3,
.modal-content h4,
.modal-content h5 {
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #666;
  font-size: 22px;
  line-height: 36px;
  cursor: pointer;
  transition: all 0.15s ease, color 0.15s ease;
}
.modal-close:hover {
  background: #f0f0f0;
  color: #222;
}
.modal-close:focus {
  outline: 2px solid #2684ff;
  outline-offset: 2px;
}

.modal-body {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed #eee;
}
.score-row:last-child {
  border-bottom: 0;
}
.game-name {
  font-weight: 600;
  color: #333;
}
.game-points {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #111;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  padding: 12px 20px 16px;
  border-top: 1px solid #eee;
  background: #fafafa;
  font-weight: 600;
}

/* ========================
       RESPONSIVIDADE
======================== */
@media (max-width: 768px) {
  .header {
    margin: 16px;
    padding: 12px;
  }
  .header h1 {
    font-size: 20px;
  }
  .logo {
    height: 42px;
  }
  .table-header,
  .table-row,
  .cell {
    font-size: 0.9em;
  }
  .header-cell,
  .cell {
    padding: 10px;
  }
  .ranking-table-container {
    max-width: 100%;
  }
}

/* ========================
         ANIMAÇÕES
======================== */
@keyframes pulse-gold {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 10px 30px var(--shadow-heavy);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(255, 215, 0, 0.4);
  }
}
@keyframes pulse-silver {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 10px 30px var(--shadow-heavy);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(192, 192, 192, 0.4);
  }
}
@keyframes pulse-bronze {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 10px 30px var(--shadow-heavy);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(205, 127, 50, 0.4);
  }
}
.pulse-gold {
  animation: pulse-gold 2s ease-in-out infinite;
}
.pulse-silver {
  animation: pulse-silver 2s ease-in-out infinite 0.2s;
}
.pulse-bronze {
  animation: pulse-bronze 2s ease-in-out infinite 0.4s;
}
