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

body {
  font-family: "Arial", sans-serif;
  background: #d4e4ff;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-page.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-page h1 {
  font-size: 3rem;
  margin-bottom: 10px;
  animation: fadeInDown 1s ease;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-page h2 {
  font-size: 1.5rem;
  margin-bottom: 30px;
  animation: fadeInUp 1s ease;
  opacity: 0.8;
}

.loader {
  border: 16px solid rgba(255, 255, 255, 0.2);
  border-top: 16px solid #fff;
  border-radius: 50%;
  width: 120px;
  height: 120px;
  animation: spin 1.5s linear infinite;
  margin-top: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 0.8;
    transform: translateY(0);
  }
}

/* Welcome Section */
.Welcome {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #d4e4ff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #333;
  text-align: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  z-index: 1000;
}

.Welcome.show {
  opacity: 1;
  visibility: visible;
}

.Welcome.hidden {
  opacity: 0;
  visibility: hidden;
}

.Welcome h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  animation: slideInFromTop 0.8s ease;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
}

.Welcome p {
  font-size: 1.3rem;
  margin-bottom: 40px;
  animation: slideInFromBottom 0.8s ease;
  opacity: 0.9;
  max-width: 600px;
}

.start-game {
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #667eea;
  background: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.start-game:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.start-game:active {
  transform: scale(0.95);
}

/* Tombol Cara Bermain */
.cara-bermain {
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #977efd 0%, #7957f5 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  margin-top: 20px;
  animation: slideInFromBottom 0.8s ease;
}

.cara-bermain:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  background: linear-gradient(135deg, #7957f5 0%, #977efd 100%);
}

.cara-bermain:active {
  transform: scale(0.95);
}

/* Modal Cara Bermain */
.caraBermain {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 90%;
  max-width: 600px;
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.caraBermain.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.caraBermain h2 {
  color: #667eea;
  font-size: 2.5rem;
  margin-bottom: 25px;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.hidden {
  display: none;
}

.caraBermain ol {
  color: #333;
  font-size: 1.1rem;
  line-height: 2;
  padding-left: 30px;
  margin-bottom: 30px;
}

.caraBermain li {
  margin-bottom: 15px;
  padding-left: 10px;
}

.caraBermain li::marker {
  color: #667eea;
  font-weight: bold;
  font-size: 1.3rem;
}

/* Tombol Tutup Modal */
.close-modal {
  display: block;
  margin: 0 auto;
  padding: 12px 35px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.close-modal:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.close-modal:active {
  transform: scale(0.95);
}

/* Overlay untuk modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Notifikasi Game Over Custom */
.notif-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.notif-overlay.show {
  opacity: 1;
  visibility: visible;
}

.notif-box {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 50px;
  border-radius: 20px;
  text-align: center;
  color: #fff;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
  transform: scale(0.7);
  transition: transform 0.3s ease;
  max-width: 90%;
}

.notif-overlay.show .notif-box {
  transform: scale(1);
}

.notif-box h2 {
  font-size: 3rem;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.notif-skor {
  font-size: 1.5rem;
  margin-bottom: 15px;
  font-weight: bold;
}

.notif-skor #skor-akhir {
  font-size: 2.5rem;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

.notif-pesan {
  font-size: 1.1rem;
  margin-bottom: 30px;
  opacity: 0.9;
}

.btn-kembali {
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #667eea;
  background: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn-kembali:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.btn-kembali:active {
  transform: scale(0.95);
}

.gameArea.show {
  opacity: 1;
  visibility: visible;
}
.gameArea.hidden {
  opacity: 0;
  visibility: hidden;
}

.gameArea {
  width: 65vmin;
  height: 85vmin;
  background: #293447;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@media  (min-width: 320px) and (max-width: 767px) {
    .gameArea {
        width: 90vmin;
        height: 110vmin;
    }
}

.gameInfo {
  display: flex;
  background-color: #394964;
  justify-content: space-between;
  padding: 18px;
  font-size: 1.2rem;
  font-weight: 600;
  /* margin-bottom: 15px; */
  color: #fff;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.papanPermainan {
  width: 100%;
  height: 100%;
  display: grid;
  background-color: #212837;
  grid-template: repeat(20, 1fr) / repeat(20, 1fr);
}

.papanPermainan .buah {
  width: 100%;
  height: 100%;
  background-color: #ff4757;
  border-radius: 20px;
}
.papanPermainan .bom {
  width: 100%;
  height: 100%;
  background-color: #000000;
  border-radius: 20px;
}
.papanPermainan .kepala {
  width: 100%;
  height: 100%;
  background-color: #0022ff;
  border-radius: 5px;
}

/* Tombol Kontrol Game (Panah) */

.kontrol {
    padding: 10px;
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
}
.kontrol button {
  /* position: absolute; */
  background: transparent;
  border: none;
  width: 100px;
  height: 60px;
  border-radius: 12px;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
}

.kontrol button:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.kontrol button:active {
  transform: scale(0.9);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 0.9;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .Welcome h1 {
    font-size: 2.5rem;
  }

  .Welcome p {
    font-size: 1rem;
  }

  .start-game {
    padding: 12px 30px;
    font-size: 1rem;
  }

  .cara-bermain {
    padding: 12px 30px;
    font-size: 1rem;
  }

  .caraBermain {
    width: 95%;
    padding: 25px;
  }

  .caraBermain h2 {
    font-size: 1.8rem;
  }

  .caraBermain ol {
    font-size: 0.95rem;
  }

  .loading-page h1 {
    font-size: 2rem;
  }

  .loading-page h2 {
    font-size: 1.2rem;
  }
}
