/* PB BILIBILI 162 — Prestasi mobile responsive hardening */

#prestasi {
  overflow-x: clip;
}

/* Current PublicPrestasi layout: always show Ajatappareng before Local Parepare. */
#prestasi .prestasi-events > .prestasi-event-card:nth-child(1) { order: 2; }
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) { order: 1; }

/* Keep AJP photos in their current positions. */
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(2) .prestasi-player-grid > :first-child { order: 1; }
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(2) .prestasi-player-grid > :last-child { order: 2; }

/* Keep Nugi–Saldi photos unchanged: left photo stays Nugi, right photo stays Saldi. */
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(3) .prestasi-player-grid > :first-child { order: 2; }
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(3) .prestasi-player-grid > :last-child { order: 1; }

/* Fixed public names for Ahmad Halim–Gusmulyadi. */
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(2) .prestasi-player-grid > :first-child .prestasi-player-name { font-size: 0; }
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(2) .prestasi-player-grid > :first-child .prestasi-player-name::after { content: "Gusmulyadi"; font-size: 11px; }
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(2) .prestasi-player-grid > :last-child .prestasi-player-name { font-size: 0; }
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(2) .prestasi-player-grid > :last-child .prestasi-player-name::after { content: "Ahmad Halim"; font-size: 11px; }

/* Nugi–Saldi: photos stay fixed; ONLY the names are swapped. */
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(3) .prestasi-player-grid > :first-child .prestasi-player-name { font-size: 0; }
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(3) .prestasi-player-grid > :first-child .prestasi-player-name::after { content: "Saldi"; font-size: 11px; }
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(3) .prestasi-player-grid > :last-child .prestasi-player-name { font-size: 0; }
#prestasi .prestasi-events > .prestasi-event-card:nth-child(2) .prestasi-results > .prestasi-result-card:nth-child(3) .prestasi-player-grid > :last-child .prestasi-player-name::after { content: "Nugi"; font-size: 11px; }

@media (max-width: 767px) {
  #prestasi { padding-top: 3.25rem !important; padding-bottom: 3.5rem !important; }
  #prestasi > .max-w-7xl { width: 100% !important; max-width: 100% !important; padding-left: 14px !important; padding-right: 14px !important; box-sizing: border-box !important; }
  #prestasi .prestasi-events { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 16px !important; width: 100% !important; min-width: 0 !important; }
  #prestasi .prestasi-events > .prestasi-event-card { order: initial; width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
  #prestasi .prestasi-events > .prestasi-event-card:nth-child(1) { order: 2 !important; }
  #prestasi .prestasi-events > .prestasi-event-card:nth-child(2) { order: 1 !important; }
  #prestasi .prestasi-event-head { padding: 16px !important; gap: 10px !important; }
  #prestasi .prestasi-event-name { font-size: 18px !important; line-height: 1.18 !important; overflow-wrap: anywhere !important; }
  #prestasi .prestasi-results { grid-template-columns: minmax(0, 1fr) !important; gap: 10px !important; padding: 12px !important; }
  #prestasi .prestasi-result-card { width: 100% !important; min-width: 0 !important; }
  #prestasi .prestasi-player-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 7px !important; }
  #prestasi .prestasi-result-card img { max-width: 100% !important; }
  #prestasi .mb-10 > .grid { grid-template-columns: minmax(0, 1fr) !important; gap: 16px !important; width: 100% !important; }
  #prestasi .mb-10 { margin-bottom: 2.75rem !important; }
  #prestasi .mb-10 > .text-center { margin-bottom: 1.25rem !important; }
  #prestasi .mb-10 > .text-center > div:first-child { max-width: 100% !important; justify-content: center !important; align-items: flex-start !important; }
  #prestasi .mb-10 > .text-center > div:first-child span { font-size: 1rem !important; line-height: 1.25 !important; white-space: normal !important; overflow-wrap: anywhere !important; }
  #prestasi .mb-10 > .text-center > div:last-child { flex-direction: column !important; align-items: center !important; gap: 6px !important; font-size: 0.68rem !important; }
  #prestasi article { width: 100% !important; min-width: 0 !important; padding: 14px !important; border-radius: 22px !important; box-sizing: border-box !important; }
  #prestasi article > .relative.z-10 { align-items: flex-start !important; margin-bottom: 14px !important; }
  #prestasi article > .relative.z-10 h4 { font-size: 1.08rem !important; line-height: 1.2 !important; overflow-wrap: anywhere !important; }
  #prestasi article > .grid { grid-template-columns: minmax(0, 1fr) !important; gap: 10px !important; }
  #prestasi article > .grid > div { min-width: 0 !important; border-radius: 17px !important; }
  #prestasi article > .grid > div > .grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 7px !important; }
  #prestasi article img { max-width: 100% !important; }
  #prestasi article > .grid > div > .grid > div { min-width: 0 !important; aspect-ratio: 4 / 5 !important; }
  #prestasi article > .grid > div > div:last-child { min-height: auto !important; padding-bottom: 13px !important; }
  #prestasi article > .grid > div > div:last-child > div:first-child { font-size: 0.86rem !important; line-height: 1.25 !important; overflow-wrap: anywhere !important; }
  #prestasi article > .grid > div > div:last-child > div:last-child { font-size: 0.66rem !important; line-height: 1.35 !important; }
}

@media (max-width: 380px) {
  #prestasi > .max-w-7xl { padding-left: 11px !important; padding-right: 11px !important; }
  #prestasi .prestasi-event-head { padding: 14px !important; }
  #prestasi .prestasi-event-name { font-size: 17px !important; }
  #prestasi .prestasi-results { padding: 10px !important; }
  #prestasi article { padding: 12px !important; }
  #prestasi article > .relative.z-10 h4 { font-size: 1rem !important; }
  #prestasi article > .grid > div > div:last-child > div:first-child { font-size: 0.8rem !important; }
}
