
:root {
  --bg-top: #FFF5FA;
  --bg-mid: #FFEBF4;
  --bg-bot: #EEF6FF;
  --card-bg: #FFFFFF;
  --primary: #FF5C93;
  --primary-dark: #D93870;
  --secondary: #7C5CFF;
  --secondary-dark: #5B3CE0;
  --mint: #2EC4B6;
  --mint-dark: #1E968A;
  --gold: #FFB703;
  --gold-dark: #D99500;
  --text-main: #3A285C;
  --text-sub: #6C588E;
  --font-round: 'Nunito', 'Quicksand', 'SF Pro Rounded', ui-rounded, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-round);
  background: linear-gradient(165deg, var(--bg-top) 0%, var(--bg-mid) 50%, var(--bg-bot) 100%);
  color: var(--text-main);
  overflow-x: hidden;
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 16px 40px;
}

/* Top Status Bar */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding: 10px 16px;
  border-radius: 26px;
  border: 3px solid #FFD1E3;
  box-shadow: 0 8px 20px rgba(255, 92, 147, 0.12);
  margin-bottom: 18px;
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-pill img {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--primary-dark);
  line-height: 1.15;
}

.brand-sub {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: #22C55E;
}

.status-dot.offline {
  background: #F59E0B;
}

.hud-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-chip {
  background: #FFF7E0;
  border: 2px solid #FFE082;
  padding: 6px 13px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-chip.streak {
  background: #FFF0EB;
  border-color: #FFBCA8;
  color: #E04F16;
}

.icon-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease;
}

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

.btn-sticker {
  background: #F3E8FF;
  color: var(--secondary-dark);
  border: 2px solid #D8B4FE;
}

.btn-install {
  background: linear-gradient(135deg, #2EC4B6, #1AA89B);
  color: #fff;
  box-shadow: 0 3px 0 var(--mint-dark);
  display: none;
}

.btn-install.visible {
  display: inline-flex;
}

/* Hero / Mascot Banner */
.hero-card {
  background: #FFFFFF;
  border-radius: 30px;
  padding: 20px 22px;
  border: 4px solid #FFC4DC;
  box-shadow: 0 12px 28px rgba(124, 92, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.mascot-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bunny-avatar {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  background: linear-gradient(145deg, #FFE3EE, #FFF4F8);
  border: 3px solid #FF8AB4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  flex-shrink: 0;
  animation: floatBunny 3s ease-in-out infinite;
}

@keyframes floatBunny {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.speech-bubble {
  background: #F8F5FF;
  border: 2px solid #E2D6FF;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-main);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.btn-3d {
  border: none;
  border-radius: 22px;
  padding: 14px 22px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-3d:active {
  transform: translateY(4px);
}

.btn-pink {
  background: linear-gradient(135deg, #FF6B9D, #FF4785);
  box-shadow: 0 5px 0 var(--primary-dark);
}
.btn-pink:active { box-shadow: 0 1px 0 var(--primary-dark); }

.btn-purple {
  background: linear-gradient(135deg, #8B6EFF, #6B4CE6);
  box-shadow: 0 5px 0 var(--secondary-dark);
}
.btn-purple:active { box-shadow: 0 1px 0 var(--secondary-dark); }

.btn-mint {
  background: linear-gradient(135deg, #34D1C3, #20B2A5);
  box-shadow: 0 5px 0 var(--mint-dark);
}
.btn-mint:active { box-shadow: 0 1px 0 var(--mint-dark); }

.btn-gold {
  background: linear-gradient(135deg, #FFC837, #FFA800);
  color: #3A285C;
  box-shadow: 0 5px 0 var(--gold-dark);
}
.btn-gold:active { box-shadow: 0 1px 0 var(--gold-dark); }

/* Filter Bar */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  background: #FFFFFF;
  border: 2.5px solid #E5D9FF;
  color: var(--text-sub);
  padding: 8px 15px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.pill.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #FFFFFF;
}

/* Topic Grid */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.topic-card {
  background: #FFFFFF;
  border-radius: 26px;
  padding: 18px;
  border: 3px solid #EADFFF;
  box-shadow: 0 8px 18px rgba(58, 40, 92, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.topic-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.topic-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topic-emoji {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}

.topic-name {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.25;
}

.topic-meta {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  margin-top: 3px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #F1ECFF;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF6B9D, #FFB703);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Quiz Screen */
.quiz-screen {
  display: none;
}

.quiz-screen.active {
  display: block;
}

.home-screen.hidden {
  display: none;
}

.quiz-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.btn-back {
  background: #FFFFFF;
  color: var(--text-main);
  border: 2.5px solid #DFD3FF;
  border-radius: 999px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.mode-switch {
  display: flex;
  background: #FFFFFF;
  padding: 4px;
  border-radius: 999px;
  border: 2.5px solid #DFD3FF;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-sub);
  cursor: pointer;
}

.mode-btn.active {
  background: var(--primary);
  color: #FFFFFF;
}

.question-card {
  background: #FFFFFF;
  border-radius: 32px;
  padding: 24px 22px;
  border: 4px solid #FFC4DC;
  box-shadow: 0 14px 32px rgba(255, 92, 147, 0.14);
  margin-bottom: 16px;
  position: relative;
}

.q-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.q-tag {
  background: #FFF0F6;
  color: var(--primary-dark);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.q-diff {
  background: #E8FBF8;
  color: var(--mint-dark);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.q-text {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.4;
  color: var(--text-main);
  margin: 8px 0 18px;
  text-align: center;
}

.q-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.tool-btn {
  border: 2.5px solid #E2D6FF;
  background: #F9F6FF;
  color: var(--text-main);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hint-box {
  margin-top: 14px;
  background: #FFFBEB;
  border: 2px dashed #F59E0B;
  border-radius: 18px;
  padding: 10px 14px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: #B45309;
  display: none;
}

.hint-box.visible {
  display: block;
}

/* 4 Choice Options */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (max-width: 600px) {
  .options-grid { grid-template-columns: 1fr; }
  .hero-card { flex-direction: column; text-align: center; }
  .mascot-box { flex-direction: column; }
  .q-text { font-size: 21px; }
}

.option-btn {
  background: #FFFFFF;
  border: 3.5px solid #DFD3FF;
  box-shadow: 0 5px 0 #DFD3FF;
  border-radius: 24px;
  padding: 18px 16px;
  font-family: inherit;
  font-size: 20px;
  font-weight: 900;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  transition: transform 0.1s ease, background 0.15s ease;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--secondary);
  background: #FAF8FF;
}

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

.option-letter {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #F1ECFF;
  color: var(--secondary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
}

.option-btn.correct {
  background: #DCFCE7;
  border-color: #22C55E;
  box-shadow: 0 5px 0 #16A34A;
  color: #14532D;
}

.option-btn.correct .option-letter {
  background: #22C55E;
  color: #FFFFFF;
}

.option-btn.wrong {
  background: #FEE2E2;
  border-color: #EF4444;
  box-shadow: 0 5px 0 #DC2626;
  color: #7F1D1D;
  animation: shake 0.35s ease;
}

.option-btn.eliminated {
  opacity: 0.3;
  pointer-events: none;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Flashcard Mode */
.flashcard-area {
  display: none;
  text-align: center;
}

.flashcard-area.active {
  display: block;
}

.answer-reveal-box {
  background: linear-gradient(145deg, #ECFDF5, #D1FAE5);
  border: 3px solid #34D399;
  border-radius: 26px;
  padding: 22px;
  margin-bottom: 14px;
  display: none;
}

.answer-reveal-box.visible {
  display: block;
}

.reveal-title {
  font-size: 14px;
  font-weight: 800;
  color: #065F46;
  margin-bottom: 6px;
}

.reveal-word {
  font-size: 30px;
  font-weight: 900;
  color: #047857;
}

/* Feedback Banner */
.feedback-panel {
  margin-top: 16px;
  background: #FFFFFF;
  border-radius: 26px;
  padding: 18px 20px;
  border: 3px solid #A7F3D0;
  display: none;
  text-align: center;
}

.feedback-panel.visible {
  display: block;
}

.feedback-title {
  font-size: 21px;
  font-weight: 900;
  color: #059669;
  margin-bottom: 8px;
}

.feedback-note {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 14px;
  line-height: 1.45;
}

/* Modal for Stickers & Offline Diagnostics */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(58, 40, 92, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: #FFFFFF;
  border-radius: 30px;
  max-width: 680px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px;
  border: 4px solid #FFC4DC;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 22px;
  color: var(--primary-dark);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.sticker-item {
  border-radius: 20px;
  padding: 14px 10px;
  text-align: center;
  border: 2.5px solid #EAE2FF;
  background: #FAF8FF;
}

.sticker-item.unlocked {
  background: linear-gradient(145deg, #FFF9DB, #FFF0F6);
  border-color: #FFD166;
}

.sticker-item.locked {
  opacity: 0.45;
  filter: grayscale(1);
}

.sticker-icon {
  font-size: 38px;
  margin-bottom: 6px;
}

.sticker-name {
  font-size: 13px;
  font-weight: 800;
}

.sticker-req {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
}

/* Confetti Canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
}
