* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', 'Segoe UI', 'Roboto', sans-serif;
  background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #047857 100%);
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  max-width: 750px;
  width: 100%;
  background: linear-gradient(180deg, #022c22 0%, #064e3b 100%);
  padding: 35px 25px;
  border-radius: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 
              0 0 0 4px rgba(16, 185, 129, 0.4);
  position: relative;
}

.container::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #10b981, #34d399, #10b981);
  border-radius: 30px;
  z-index: -1;
  opacity: 0.6;
  filter: blur(10px);
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    opacity: 0.6;
    filter: blur(10px);
  }
  50% {
    opacity: 0.8;
    filter: blur(15px);
  }
}

h1 {
  text-align: center;
  margin: 0 auto 8px auto;
  color: #fff;
  font-size: 2.5em;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 3px;
  background: linear-gradient(90deg, #059669 0%, #10b981 100%);
  padding: 18px 40px;
  border-radius: 18px;
  border: 3px solid #047857;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.6),
              inset 0 2px 4px rgba(255, 255, 255, 0.1);
  display: inline-block;
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.subtitle {
  text-align: center;
  margin: 15px 0 8px 0;
  color: #6ee7b7;
  font-size: 1em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.update {
  text-align: center;
  font-size: 12px;
  margin-bottom: 25px;
  color: #34d399;
  font-style: italic;
  font-weight: 500;
}

.update.updating {
  color: #10b981;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* TABLE HEADER - OVAL STYLE WITH GREEN-YELLOW GRADIENT */
.table-header {
  display: grid;
  grid-template-columns: 80px 140px 1fr 120px;
  gap: 10px;
  padding: 0;
  margin-bottom: 15px;
}

.table-header div {
  background: linear-gradient(90deg, #059669 0%, #10b981 50%, #fbbf24 100%);
  color: #fff;
  font-size: 0.75em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  text-align: center;
  padding: 12px 15px;
  border-radius: 50px;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.4);
  border: 2px solid #047857;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.table-header div:first-child {
  background: linear-gradient(90deg, #047857 0%, #059669 50%, #10b981 100%);
}

.table-header div:last-child {
  background: linear-gradient(90deg, #10b981 0%, #34d399 50%, #fbbf24 100%);
}

.score-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 25px;
}

.score-table thead {
  display: none;
}

.score-table tbody {
  display: block;
}

.score-table tbody tr {
  position: relative;
  background: linear-gradient(90deg, #065f46 0%, #059669 100%);
  border-radius: 50px;
  height: 70px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 80px 140px 1fr 120px;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  /* Smooth animation untuk perpindahan posisi */
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Animasi ketika posisi berubah */
.score-table tbody tr.position-changed {
  animation: positionChange 0.6s ease-in-out;
}

@keyframes positionChange {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.8);
  }
  100% {
    transform: translateY(0);
  }
}

.score-table tbody tr::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
  border-radius: 50px;
}

.score-table tbody tr::after {
  content: '▶';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.7em;
  transition: all 0.3s ease;
}

.score-table tbody tr:hover {
  transform: translateX(8px) scale(1.02);
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.7);
}

.score-table tbody tr:hover::after {
  right: 15px;
  color: rgba(255, 255, 255, 0.7);
}

.score-table td {
  border: none;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  padding: 0;
  white-space: nowrap;
}

/* Column 1: Ranking Number - ALWAYS VISIBLE */
.score-table td:nth-child(1) {
  justify-content: center;
  font-size: 1.6em;
  font-weight: 900;
}

/* Show number for rank 4+ */
.score-table tbody tr:not(.top-1):not(.top-2):not(.top-3) td:nth-child(1) {
  color: #34d399;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Column 2: Kontingen */
.score-table td:nth-child(2) {
  font-size: 0.85em;
  font-weight: 700;
  text-transform: uppercase;
  padding-left: 10px;
  justify-content: flex-start;
}

/* Column 3: Nama + Stars */
.score-table td:nth-child(3) {
  font-size: 1em;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-left: 10px;
  gap: 4px;
  line-height: 1;
}

.score-table td:nth-child(3) .name {
  font-size: 1.05em;
  line-height: 1.2;
}

.score-table td:nth-child(3) .stars {
  display: flex;
  gap: 3px;
  font-size: 1em;
  line-height: 1;
}

.star {
  color: #fbbf24;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
  font-size: 14px;
  display: inline-block;
}

.star.empty {
  color: rgba(255, 255, 255, 0.25);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Column 4: Nilai */
.score-table td:nth-child(4) {
  justify-content: center;
  font-size: 1.6em;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Top 3 Styling - FULL ROW COLOR CHANGE */
.top-1 {
  background: linear-gradient(90deg, #ea580c 0%, #f97316 50%, #fb923c 100%) !important;
  box-shadow: 0 8px 30px rgba(251, 146, 60, 0.6) !important;
  border: 2px solid #fb923c;
  animation: rankUp 0.6s ease-out !important;
}

.top-1::before {
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%) !important;
}

.top-1 td {
  color: #fff !important;
}

.top-2 {
  background: linear-gradient(90deg, #64748b 0%, #94a3b8 50%, #cbd5e1 100%) !important;
  box-shadow: 0 7px 25px rgba(203, 213, 225, 0.5) !important;
  border: 2px solid #cbd5e1;
  animation: rankUp 0.6s ease-out 0.1s !important;
}

.top-2::before {
  background: linear-gradient(90deg, rgba(203, 213, 225, 0.2) 0%, rgba(255, 255, 255, 0.15) 100%) !important;
}

.top-2 td {
  color: #1e293b !important;
}

.top-2 .star {
  color: #f59e0b !important;
}

.top-2 .star.empty {
  color: rgba(30, 41, 59, 0.3) !important;
}

.top-2::after {
  color: rgba(30, 41, 59, 0.4) !important;
}

.top-3 {
  background: linear-gradient(90deg, #92400e 0%, #c2410c 50%, #ea580c 100%) !important;
  box-shadow: 0 7px 25px rgba(234, 88, 12, 0.5) !important;
  border: 2px solid #ea580c;
  animation: rankUp 0.6s ease-out 0.2s !important;
}

.top-3::before {
  background: linear-gradient(90deg, rgba(234, 88, 12, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%) !important;
}

.top-3 td {
  color: #fff !important;
}

@keyframes rankUp {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Medal Icons for Top 3 */
.top-1 td:first-child,
.top-2 td:first-child,
.top-3 td:first-child {
  position: relative;
}

.top-1 td:first-child::before,
.top-2 td:first-child::before,
.top-3 td:first-child::before {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2em;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.top-1 td:first-child::before {
  content: '🥇';
}

.top-2 td:first-child::before {
  content: '🥈';
}

.top-3 td:first-child::before {
  content: '🥉';
}

/* Make number invisible but keep layout - use opacity instead of font-size */
.top-1 td:first-child,
.top-2 td:first-child,
.top-3 td:first-child {
  color: transparent !important;
}

/* PODIUM SECTION */
.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin-top: 30px;
  gap: 12px;
  padding: 0 10px;
}

.juara {
  flex: 1;
  max-width: 220px;
  padding: 25px 15px;
  border-radius: 20px;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  border: 3px solid;
  position: relative;
  overflow: hidden;
}

.juara::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
}

.juara:hover {
  transform: translateY(-10px) scale(1.05);
}

.juara strong {
  font-size: 1.15em;
  display: block;
  margin: 10px 0 5px 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  line-height: 1.3;
}

.juara small {
  font-size: 0.82em;
  opacity: 0.95;
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.juara .stars {
  display: flex;
  gap: 4px;
  margin: 8px 0;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.juara .stars .star {
  display: inline-block;
  font-size: 16px;
}

.juara .score {
  font-size: 2em;
  font-weight: 900;
  display: block;
  margin-top: 5px;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

.gold {
  background: linear-gradient(135deg, #ea580c 0%, #f97316 50%, #fb923c 100%);
  border-color: #fb923c;
  order: 2;
  min-height: 170px;
  box-shadow: 0 12px 35px rgba(251, 146, 60, 0.6);
}

.silver {
  background: linear-gradient(135deg, #64748b 0%, #94a3b8 50%, #cbd5e1 100%);
  border-color: #cbd5e1;
  order: 1;
  min-height: 150px;
  box-shadow: 0 10px 30px rgba(203, 213, 225, 0.5);
}

.bronze {
  background: linear-gradient(135deg, #92400e 0%, #c2410c 50%, #ea580c 100%);
  border-color: #ea580c;
  order: 3;
  min-height: 150px;
  box-shadow: 0 10px 30px rgba(234, 88, 12, 0.5);
}

/* Live Update Indicator */
.live-indicator {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #10b981;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.5);
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0%, 100% {
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.5);
  }
  50% {
    box-shadow: 0 2px 20px rgba(16, 185, 129, 0.9);
  }
}

.live-indicator::before {
  content: '●';
  margin-right: 5px;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Smooth data change animation */
@keyframes dataChange {
  0% {
    background-color: rgba(16, 185, 129, 0.4);
  }
  100% {
    background-color: transparent;
  }
}

.data-changed {
  animation: dataChange 1s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 25px 15px;
    border-radius: 20px;
  }

  h1 {
    font-size: 1.8em;
    padding: 14px 25px;
    letter-spacing: 2px;
  }

  .table-header {
    grid-template-columns: 60px 90px 1fr 85px;
    gap: 8px;
  }

  .table-header div {
    font-size: 0.65em;
    padding: 10px 8px;
  }

  .score-table tbody tr {
    height: 65px;
    padding: 0 15px;
    grid-template-columns: 60px 90px 1fr 85px;
    gap: 8px;
  }

  .score-table td:nth-child(1) {
    font-size: 1.3em;
  }

  .score-table td:nth-child(2) {
    font-size: 0.7em;
    padding-left: 5px;
  }

  .score-table td:nth-child(3) {
    font-size: 0.85em;
    padding-left: 5px;
  }

  .score-table td:nth-child(3) .stars {
    font-size: 0.75em;
    gap: 1px;
  }

  .score-table td:nth-child(4) {
    font-size: 1.3em;
  }

  .podium {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
  }

  .gold,
  .silver,
  .bronze {
    order: 0;
    max-width: 100%;
    min-height: 120px;
  }

  .live-indicator {
    top: 10px;
    right: 10px;
    font-size: 0.65em;
    padding: 5px 10px;
  }
}

/* Loading State */
.loading {
  text-align: center;
  padding: 20px;
  color: #34d399;
  font-style: italic;
  grid-column: 1 / -1;
}

/* Error State */
.error {
  text-align: center;
  padding: 20px;
  color: #ef4444;
  font-weight: 600;
  grid-column: 1 / -1;
}