/* General Styling */
body {
  background-image: url('Candies/bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  min-height: 100vh;
  margin: 0;
  padding: 10px 20px;
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
  color: #85796b;
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 8), 1fr);
  grid-template-rows: repeat(var(--grid-rows, 8), 1fr);
  gap: 4px;
  height: 560px;
  width: 560px;
  background-color: rgba(109, 127, 151, 0.45);
  padding: 8px;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4) inset, 0 1px 0 #fff;
  margin: 0;
  box-sizing: border-box;
}

.grid div {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 6px;
  transition: transform 0.15s ease;
  box-sizing: border-box;
}

/* Hover effect for interactivity */
.grid div:not(.tile-void):hover {
  transform: scale(1.08);
}

.tile-void {
  visibility: hidden !important;
  pointer-events: none !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Scoreboard Styling (Left Side) */
.scoreBoard {
  background-color: #e8f8f5;
  border: 2px solid #16a085;
  border-radius: 20px;
  width: 220px;
  min-height: 240px;
  height: auto;
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  color: #2c3e50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin: 0;
  box-sizing: border-box;
}

/* Boss & Enemy Panel (Right Side) */
.boss-panel {
  width: 220px;
  min-height: 240px;
  background-color: #fdf2f2;
  border: 2px solid #e74c3c;
  border-radius: 20px;
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: #2c3e50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin: 0;
  box-sizing: border-box;
}

.boss-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.boss-sprite-box {
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.75);
  border: 2px dashed #e74c3c;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
}

.boss-sprite-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px;
}

h3,
h1 {
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  margin: 0;
}

h1 {
  margin-top: -10px;
}

.grid div:hover {
  transform: scale(1.05);
  /* Slightly enlarge on hover */
}

/* Mode Selection / Main Menu Styling */
#modeSelection {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  background: rgba(18, 30, 49, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: 'Montserrat', sans-serif;
  box-sizing: border-box;
  padding: 20px;
}

.menu-hero-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.5);
  max-width: 580px;
  width: 100%;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  animation: heroFadeIn 0.35s ease-out;
}

@keyframes heroFadeIn {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.menu-profile-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: bold;
}

#playerBadge {
  background: #e8f8f5;
  color: #16a085;
  border: 1px solid #a3e4d7;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

#playerBadge:hover {
  background: #d1f2eb;
  transform: scale(1.02);
}

.menu-streak-badge {
  background: #fdf2e9;
  color: #d35400;
  border: 1px solid #f5cba7;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 500;
}

.menu-pb-badge {
  background: #fef9e7;
  color: #b7950b;
  border: 1px solid #f9e79f;
  padding: 5px 12px;
  border-radius: 20px;
}

.menu-brand {
  margin-bottom: 22px;
}

.menu-icon {
  font-size: 46px;
  margin-bottom: 4px;
}

.menu-title {
  font-size: 26px;
  color: #16a085;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.menu-subtitle {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #e74c3c;
  margin-top: 4px;
}

.menu-tagline {
  font-size: 12px;
  color: #636e72;
  margin-top: 8px;
  line-height: 1.4;
  max-width: 440px;
}

.mode-cards-container {
  display: flex;
  gap: 16px;
  width: 100%;
  margin-bottom: 22px;
}

.mode-card {
  flex: 1;
  background: #ffffff;
  border: 2px solid #e0f2f1;
  border-radius: 16px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mode-card:hover {
  transform: translateY(-4px);
  border-color: #1abc9c;
  box-shadow: 0 10px 20px rgba(26, 188, 156, 0.2);
}

.mode-card.mode-timed:hover {
  border-color: #e74c3c;
  box-shadow: 0 10px 20px rgba(231, 76, 60, 0.2);
}

.mode-icon {
  font-size: 34px;
  margin-bottom: 6px;
}

.mode-name {
  font-size: 15px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 6px 0;
}

.mode-desc {
  font-size: 11px;
  color: #7f8c8d;
  line-height: 1.35;
  margin: 0 0 12px 0;
}

.mode-badge {
  font-size: 10px;
  font-weight: bold;
  background: #e8f8f5;
  color: #16a085;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
}

.mode-badge.badge-timed {
  background: #fdeed9;
  color: #e67e22;
}

.menu-nav-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  border-top: 1px solid #f1f2f6;
  padding-top: 16px;
}

.menu-nav-btn {
  background: #f1f2f6;
  color: #2c3e50;
  border: 1px solid #dfe4ea;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.menu-nav-btn:hover {
  background: #e4e7eb;
  transform: translateY(-1px);
}

.menu-sound-btn {
  background: #27ae60 !important;
  color: #ffffff !important;
  border: none !important;
}

/* Timer and Change Mode Button */
#timer {
  font-size: 18px;
  margin-top: 10px;
}

#changeMode {
  margin-top: 10px;
  padding: 5px 10px;
  background-color: #ff6347;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* Initially Hide Game Elements */
.grid,
.scoreBoard,
#bossContainer {
  display: none;
}

.progress-container {
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 10px;
  margin: 5px 0;
  height: 12px;
  overflow: hidden;
}

#progressBar {
  width: 0%;
  height: 100%;
  background-color: #4caf50;
  transition: width 0.3s ease;
}

.stars-container {
  display: flex;
  gap: 10px;
  font-size: 20px;
  color: #ccc;
  /* Warna default (belum dicapai) */
}

.star.active {
  color: #ffd700;
  /* Warna emas apabila dicapai */
  transform: scale(1.2);
  transition: all 0.2s ease;
}

/* Boss Health Bar */
.boss-hp-container {
  width: 100%;
  background-color: #fce4e4;
  border: 1px solid #e74c3c;
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
  margin-top: 2px;
}

#bossHpBar {
  width: 100%;
  height: 100%;
  background-color: #e74c3c;
  transition: width 0.25s ease;
}

/* Floating Combo / Kill Callout */
.callout-text {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 32px;
  font-weight: bold;
  color: #e74c3c;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 100;
}

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

/* Event Banner */
.event-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #f39c12;
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: 100;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal-box {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.modal-btn {
  background-color: #27ae60;
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}

.modal-btn:hover {
  opacity: 0.9;
}

/* Toast Container */
#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  background: #34495e;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Special Line-Clear Candies */
.special-h {
  box-shadow: 0 0 10px #3498db, inset 0 0 6px #2980b9;
  border-top: 3px solid #3498db;
  border-bottom: 3px solid #3498db;
  box-sizing: border-box;
}

.special-v {
  box-shadow: 0 0 10px #e74c3c, inset 0 0 6px #c0392b;
  border-left: 3px solid #e74c3c;
  border-right: 3px solid #e74c3c;
  box-sizing: border-box;
}

.special-cross {
  box-shadow: 0 0 14px #f1c40f, inset 0 0 8px #e67e22;
  border: 2px dashed #f39c12;
  box-sizing: border-box;
  animation: pulseSpecial 1.2s infinite alternate ease-in-out;
}

@keyframes pulseSpecial {
  from {
    transform: scale(0.98);
    filter: drop-shadow(0 0 4px #f1c40f);
  }

  to {
    transform: scale(1.08);
    filter: drop-shadow(0 0 12px #e67e22);
  }
}