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

body {
  font-family: 'Baloo 2', 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 50%, #fbc2eb 100%);
  min-height: 100vh;
  color: #2d2d3a;
  overflow-x: hidden;
}

.game-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 60px;
  min-height: 100vh;
  position: relative;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.game-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ff5e78;
  text-shadow: 1px 1px 0 #fff;
}

.back-btn {
  text-decoration: none;
  background: #fff;
  color: #5b6bff;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 50px;
  font-size: 0.9rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.mascot {
  font-size: 2rem;
  animation: bob 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-8px) rotate(4deg); }
}

.screen { display: none; }
.screen.active { display: block; }

/* ---------- Home screen ---------- */
#screen-home h2 {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 18px 0 12px;
  color: #3a3a5a;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.choice-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 18px;
  border: none;
  border-radius: 16px;
  background: #fff;
  color: #4a4a6a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.choice-btn:hover { transform: translateY(-2px); }

.choice-btn.selected {
  background: linear-gradient(160deg, #5b6bff, #9b8cff);
  color: #fff;
}

.class-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.class-row .choice-btn {
  padding: 10px 6px;
  font-size: 0.9rem;
}

.topic-row .choice-btn { flex: 1 1 150px; }

.choice-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.choice-btn:disabled:hover { transform: none; }

.cta-btn {
  display: block;
  margin: 26px auto 0;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.2rem;
  padding: 16px 40px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(160deg, #ff8bc6, #ff5e99);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255,94,153,0.4);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.cta-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.cta-btn:not(:disabled):hover { transform: translateY(-3px) scale(1.02); }

.secondary-btn {
  background: linear-gradient(160deg, #5b6bff, #9b8cff);
  box-shadow: 0 8px 20px rgba(91,107,255,0.4);
  font-size: 1rem;
  padding: 12px 28px;
}

/* ---------- Game screen ---------- */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 1.1rem;
}

.hud-item {
  background: #fff;
  padding: 6px 14px;
  border-radius: 50px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.progress-bar-outer, .timer-bar-outer {
  background: rgba(255,255,255,0.6);
  border-radius: 20px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #4fd39a, #33b17a);
  width: 0%;
  transition: width 0.3s ease;
}

.timer-bar-outer { height: 8px; margin-bottom: 20px; }

.timer-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #ffb454, #ff5e78);
  width: 100%;
  transition: width 1s linear;
}

.question-box {
  text-align: center;
  background: #fff;
  border-radius: 22px;
  padding: 30px 20px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  margin-bottom: 22px;
}

.q-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: #9b9bb0;
  margin-bottom: 10px;
}

.question-text {
  font-size: 2rem;
  font-weight: 800;
  color: #2d2d3a;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.option-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.4rem;
  padding: 20px 10px;
  border: none;
  border-radius: 18px;
  background: #fff;
  color: #3a3a5a;
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, color 0.2s ease;
}

.option-btn:not(:disabled):hover { transform: translateY(-3px); }

.option-btn.correct {
  background: linear-gradient(160deg, #4fd39a, #33b17a);
  color: #fff;
}

.option-btn.wrong {
  background: linear-gradient(160deg, #ff8b8b, #ff5e5e);
  color: #fff;
}

.option-btn:disabled { cursor: not-allowed; }

.feedback {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 18px;
  min-height: 30px;
}

/* ---------- Result screen ---------- */
#screen-result {
  text-align: center;
  padding-top: 40px;
}

#result-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #ff5e78;
  margin-bottom: 14px;
}

.stars {
  font-size: 2.6rem;
  margin-bottom: 14px;
}

#result-detail {
  font-size: 1.1rem;
  font-weight: 700;
  color: #4a4a6a;
  margin-bottom: 10px;
}

.result-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ---------- Confetti ---------- */
#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 999;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  opacity: 0.9;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(600deg);
    opacity: 0.2;
  }
}

@media (max-width: 380px) {
  .question-text { font-size: 1.6rem; }
  .option-btn { font-size: 1.2rem; padding: 16px 8px; }
  .class-row { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .class-row .choice-btn { font-size: 0.78rem; padding: 8px 2px; }
}

/* ---------- Developer credit ---------- */
.dev-credit {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 30px auto 0;
  padding: 10px 20px 10px 10px;
  background: #fff;
  border-radius: 50px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  width: fit-content;
}

.dev-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.dev-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.dev-initials {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #5b6bff, #9b8cff);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}

.dev-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.25;
}

.dev-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #9b9bb0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dev-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #3a3a5a;
}
