/* Import Font dari Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

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

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #0f0a1c 0%, #190e2e 50%, #24113f 100%);
  color: #f8fafc;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

h1 {
  font-size: 2rem;
  margin-bottom: 30px;
  color: #9e04c9;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Grid Layout Konten */
.contents {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 100%;
  max-width: 1000px;
  box-sizing: border-box;
}

/* Card Utama */
.child-content {
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.child-content:hover {
  border-color: rgba(192, 132, 252, 0.4);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.25);
  transform: translateY(-3px);
}

h2 {
  font-size: 1.25rem;
  color: #cd61ff;
  margin-bottom: 12px;
}

hr {
  border: 0;
  height: 1px;
  background: rgba(131, 15, 199, 0.1);
  margin-bottom: 20px;
}

/* Stat Items */
.local-stat-item,
.session-stat-item {
  background: rgba(34, 15, 42, 0.5);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  border-left: 4px solid #9b38f8;
}

h3 {
  font-size: 0.95rem;
  font-weight: 400;
  color: #94a3b8;
  margin-bottom: 6px;
}

.local-stat-item h3[id],
.session-stat-item h3[id] {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fbf8fc;
}

/* Game Board Specifics */
#gameboard h1 {
  font-size: 2.5rem;
  color: #f43f5e;
  margin: 15px 0;
  letter-spacing: 2px;
}

/* Tampilan Tombol Jawaban (1, 2, 3) */
.answer-button {
  width: 60px;
  height: 60px;
  margin: 8px;
  font-size: 1.5rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: #bb38f8;
  color: #0f172a;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4);
}

.answer-button:hover {
  background: #9c0ee9;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6);
}

.answer-button:active {
  transform: translateY(0);
}

/* Tombol Biasa (Bermain / Hapus Data) */
.button {
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 10px;
}

#play-button {
  background: #10b981;
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  animation: pulse 2s infinite;
}

#play-button:hover {
  background: #059669;
}

#destroy-data-button {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

#destroy-data-button:hover {
  background: #dc2626;
}

/* List Instruksi */
#instructions-list {
  padding-left: 20px;
  color: #cbd5e1;
  line-height: 1.6;
  font-size: 0.9rem;
}

#instructions-list li {
  margin-bottom: 10px;
}

/* Modal Overlay & Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Teks di dalam modal */
.modal-content h2 {
  color: #f8fafc !important;
  font-size: 1.35rem;
  margin-bottom: 10px;
  word-break: break-word;
}

.modal-content p {
  color: #cbd5e1 !important;
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

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

.modal-content {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 24px 20px;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  transform: scale(0.8);
  transition: transform 0.3s ease;
  box-sizing: border-box;
  z-index: 2001;
}

.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

/* Animasi pulse lembut pada tombol Play */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(147, 51, 234, 0.6);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(147, 51, 234, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(147, 51, 234, 0);
  }
}

/* Animasi Shake */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}

.shake-animation {
  animation: shake 0.4s ease-in-out;
}

/* Container Timer */
.timer-container {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px 16px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.timer-container strong {
  font-size: 1.2rem;
  color: #ef4444;
  margin: 0 2px;
}

/* Keterangan Game Over */
.time-up-text {
  color: #ef4444 !important;
  font-weight: 700;
}

/* Tampilan Status Result (Game Over / Menang) */
.result-card {
  background: rgba(15, 10, 28, 0.6);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 10px;
}

.result-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* Status Menang */
.status-win .result-badge {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.status-win .answer-highlight {
  color: #4ade80;
  text-shadow: 0 0 15px rgba(74, 222, 128, 0.5);
}

/* Status Kalah / Game Over */
.status-lose .result-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-lose .answer-highlight {
  color: #f43f5e;
  text-shadow: 0 0 15px rgba(244, 63, 94, 0.5);
}

.result-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-subtitle {
  font-size: 0.9rem;
  color: #a78bfa;
  margin-bottom: 4px;
}

.answer-highlight {
  font-size: 3rem !important;
  font-weight: 800;
  margin: 10px 0 !important;
  letter-spacing: 4px;
}

.restart-hint {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 15px;
}

.level-selector {
  display: flex;
  gap: 8px;
  margin: 16px 0 20px;
}

.level-btn {
  flex: 1;
  padding: 10px 8px;
  background: rgba(15, 10, 28, 0.6);
  border: 1px solid rgba(192, 132, 252, 0.2);
  color: #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.level-btn.active {
  background: #a855f7;
  color: #fff;
  border-color: #c084fc;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

/* Responsive khusus Layar HP */
@media only screen and (max-width: 600px) {
  body {
    padding: 20px 12px;
  }

  h1 {
    font-size: 1.4rem;
  }

  .modal-content {
    padding: 20px 16px;
  }

  .modal-content h2 {
    font-size: 1.2rem;
  }

  .modal-content p {
    font-size: 0.88rem;
  }

  /* Kecilkan tombol jawaban di HP agar pas sejajar */
  .answer-button {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
    margin: 4px;
  }
}

/* Tampilan khusus HP (Layar di bawah 600px) */
@media only screen and (max-width: 600px) {
  body {
    padding: 16px 12px;
  }

  h1 {
    font-size: 1.3rem;
    margin-bottom: 20px;
  }

  .child-content {
    padding: 16px;
  }

  .answer-button {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
    margin: 4px;
  }
}
