* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
  background-attachment: fixed;
  color: white;
  min-height: 100vh;
  padding: 0;
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

.hidden { display: none!important; }

/* INSTRUCTIONS - FULL SCREEN MOBILE */
#instructions {
  width: 100vw;
  min-height: 100vh;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  padding: 30px 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#instructions h1 {
  text-align: center;
  margin-bottom: 25px;
  font-size: 26px;
  font-weight: 900;
  color: #FFD93D;
  text-shadow: 0 0 10px rgba(255,217,61,0.5);
}
.rules p {
  margin: 14px 0;
  font-size: 15px;
  line-height: 1.6;
  opacity: 0.9;
}
#startBtn {
  width: 100%;
  margin-top: 30px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 18px;
  border-radius: 18px;
  font-weight: 900;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 6px 25px rgba(102,126,234,0.5);
  transition: 0.2s;
}
#startBtn:active { transform: scale(0.96); }

/* GAME - MOBILE LAYOUT */
#game {
  width: 100vw;
  padding: 12px;
}

header {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  padding: 14px 16px;
  border-radius: 20px;
  margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}
header div { display: flex; gap: 15px; align-items: center; }
#lives { color: #ff4d6d; } #coins { color: #FFD93D; } #streak { color: #ff7b25; }
header button {
  background: #FFD93D;
  border: none;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255,217,61,0.4);
}

.score-bar {
  width: 100%;
  background: rgba(0,0,0,0.35);
  padding: 12px;
  border-radius: 16px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 14px;
  letter-spacing: 1px;
  color: #FFD93D;
}

main { width: 100%; }

.question-box {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  padding: 20px 16px;
  border-radius: 20px;
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

/* 2x4 GRID FOR 8 CATEGORIES */
#categories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.type-btn {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.15);
  color: white;
  padding: 12px 8px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  text-align: center;
}
.type-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #764ba2;
  box-shadow: 0 0 15px rgba(118,75,162,0.6);
  transform: scale(1.03);
}
.type-btn.locked { opacity: 0.4; cursor: not-allowed; }
.cost {
  display: block;
  font-size: 11px;
  color: #FFD93D;
  margin-top: 3px;
  font-weight: 600;
}

#question {
  font-size: 32px;
  font-weight: 900;
  margin: 18px 0;
  text-align: center;
  text-shadow: 0 3px 15px rgba(0,0,0,0.4);
  letter-spacing: 1px;
}
#msg {
  font-size: 15px;
  font-weight: 700;
  min-height: 24px;
  text-align: center;
}

/* 2x2 GRID FOR OPTIONS */
#options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.option {
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.25);
  color: white;
  font-size: 24px;
  font-weight: 800;
  padding: 20px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.option:active { transform: scale(0.95); }
.option:disabled { cursor: not-allowed; }
.option.correct {
  background: linear-gradient(135deg, #4CAF50, #2E7D32)!important;
  border-color: #4CAF50;
  animation: correctPop 0.3s;
}
.option.wrong {
  background: linear-gradient(135deg, #ff4d6d, #c62828)!important;
  border-color: #ff4d6d;
  animation: shake 0.3s;
}

.progress-bar,.timer {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.12);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 12px;
}
#progress { height: 100%; width: 0%; background: linear-gradient(90deg, #667eea, #764ba2); transition: width 0.3s; }
#timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #FFD700, #FF8A00, #FF4D6D); transition: width 0.1s linear; }

#powerup {
  width: 100%;
  background: linear-gradient(90deg, #FFD93D, #FFA500);
  border: none;
  color: #000;
  font-weight: 900;
  padding: 16px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 0 25px rgba(255, 217, 61, 0.6);
  animation: pulse 2s infinite;
}
#powerup:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; animation: none; }

/* LEADERBOARD POPUP - BUTTONS LEFT RIGHT */
#leaderboard {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  backdrop-filter: blur(10px);
}
.lb-content {
  background: rgba(15, 32, 39, 0.95);
  backdrop-filter: blur(20px);
  padding: 25px 20px;
  border-radius: 20px;
  width: 90%;
  max-width: 400px;
  border: 1px solid rgba(255,255,255,0.2);
  text-align: center;
}
.lb-content h2 { text-align: center; margin-bottom: 15px; font-size: 22px; }
#lb-list { list-style: none; margin: 15px 0; }
#lb-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 15px; }
.lb-content button {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  margin: 8px 0 0 0;
  cursor: pointer;
  width: 48%;
}
.lb-content button:first-of-type { float: left; }
.lb-content button:last-child { float: right; }
.lb-content::after { content: ""; display: table; clear: both; }

/* NOT ENOUGH COINS POPUP */
#notEnoughPopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 300;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.2s;
}
.popup-content {
  background: linear-gradient(135deg, #ff4d6d, #c62828);
  backdrop-filter: blur(20px);
  padding: 30px 25px;
  border-radius: 20px;
  width: 85%;
  max-width: 350px;
  border: 2px solid #ff4d6d;
  text-align: center;
  box-shadow: 0 0 30px rgba(255,77,109,0.6);
  animation: shake 0.3s;
}
.popup-content h2 { margin-bottom: 12px; font-size: 22px; }
.popup-content p { margin-bottom: 20px; font-size: 15px; opacity: 0.9; }
.popup-content button {
  background: #FFD93D;
  color: #000;
  border: none;
  padding: 14px 25px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  width: 100%;
}

@keyframes correctPop { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.bump { animation: bump 0.2s; }
@keyframes bump { 50% { transform: scale(1.3); color: #FFD93D; } }