/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
  overflow-x: hidden;
}

body {
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  background: #f5f3ef;
  color: #0f172a;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-color: #6d28d9 #f5f3ef;
  scrollbar-width: thin;
}

body::-webkit-scrollbar {
  width: 10px;
}

body::-webkit-scrollbar-track {
  background: #f5f3ef;
}

body::-webkit-scrollbar-thumb {
  background-color: #6d28d9;
  border-radius: 5px;
  border: 2px solid #f5f3ef;
}

/* ── Nav Bar — Hanguly theme ── */
nav {
  background: #07102a;
  padding: 0 28px;
  height: 62px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 2px 20px rgba(0,0,0,.35);
}

.nav-left {
  display: flex;
  gap: 2px;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;
}
.nav-left::-webkit-scrollbar { display: none; }

/* Brand link — larger gap before nav items */
#homeLink {
  margin-right: 16px;
}

.nav-left a {
  color: rgba(255,255,255,.52);
  text-decoration: none;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .2px;
  padding: 7px 13px;
  border-radius: 8px;
  transition: all .18s;
  cursor: pointer;
  white-space: nowrap;
}

.nav-left a:hover {
  color: white;
  background: rgba(255,255,255,.08);
}

/* Active pill — gold underline style */
.nav-left a.active {
  color: white;
  background: rgba(255,255,255,.1);
  position: relative;
}
.nav-left a.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 2px;
  background: #fbbf24;
  border-radius: 2px;
}

/* Brand name text */
#homeLink span {
  font-family: 'DM Sans', 'Segoe UI', sans-serif !important;
  font-size: 1.2rem !important;
  font-weight: 900 !important;
  letter-spacing: -.3px !important;
  color: white !important;
}
/* Brand link — no hover background, no underline pill */
#homeLink:hover { background: transparent !important; }
#homeLink.active::after { display: none; }
#homeLink.active { background: transparent !important; }

/* Profile icon */
.nav-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 8px;
}
#profileLink {
  padding: 4px;
  border-radius: 50%;
  border: 2px solid rgba(139,92,246,.35);
  transition: all .18s;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none !important;
}
#profileLink:hover,
#profileLink.active {
  border-color: rgba(139,92,246,.8);
  background: rgba(139,92,246,.1);
  box-shadow: 0 0 12px rgba(139,92,246,.25);
}
.nav-right .profile-icon {
  width: 28px;
  height: 28px;
  display: block;
}

/* Mobile: hide text labels, show abbreviated or icon only */
@media (max-width: 680px) {
  nav { padding: 0 14px; }
  .nav-left { gap: 0; }
  .nav-left a { padding: 7px 9px; font-size: .76rem; }
  #homeLink span { display: none; }
  #homeLink { margin-right: 6px; }
}
@media (max-width: 480px) {
  .nav-left a { padding: 6px 7px; font-size: .72rem; letter-spacing: 0; }
}

/* Pages */
.page {
  padding: 0;
  min-height: calc(100vh - 62px);
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.page.active {
  display: block;
}

/* Inner content wrapper — use this inside pages for normal padded content */
.page-content {
  padding: 40px 30px;
}

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

/* GLOBAL BUTTON STYLING */
button, .nav-btn {
  border: none;
  padding: 12px 25px;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
  background: #4c6ef5; 
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

button:hover, .nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}

.btn-green { background-color: #2ecc71 !important; }
.btn-orange { background-color: #fd7e14 !important; }
.btn-white { background-color: white !important; color: #4c6ef5 !important; }

/* ====== HOME PAGE STYLING ====== */
.home-hero {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  border-radius: 0;
  padding: 60px 40px 80px;
  text-align: center;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.home-hero h1 {
  font-size: 2.8rem;
  margin-bottom: 15px;
  text-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.home-hero p {
  font-size: 1.2rem;
  margin-bottom: 30px;
  opacity: 0.9;
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: -50px auto 40px;
  position: relative;
  z-index: 10;
  padding: 0 20px;
  flex-wrap: wrap;
}

.status-item {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 15px 30px;
  border-radius: 100px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 15px;
  border: 1px solid rgba(255,255,255,0.5);
  min-width: 200px;
}

.status-icon { font-size: 1.8rem; }
.status-text { display: flex; flex-direction: column; }

.status-label { 
  font-size: 0.7rem; 
  text-transform: uppercase; 
  font-weight: 800; 
  color: #888; 
}
.status-value { 
  font-size: 1.1rem; 
  font-weight: 800; 
  color: #2c3e50; 
}

.challenge-pill {
  background: linear-gradient(135deg, #4c6ef5, #364fc7);
  color: white;
  border: none;
}
.challenge-pill .status-label { color: rgba(255,255,255,0.8); }
.challenge-pill .status-value { color: white; }

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  max-width: 1200px;
  margin: 0 auto 50px;
  padding: 0 20px;
}

.home-card {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
  border: 1px solid #eee;
  transition: transform 0.3s ease;
  text-align: left;
}
.home-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}
.card-icon { font-size: 2.5rem; margin-bottom: 15px; }

.card-alpha { border-top: 5px solid #1e3c72; }
.card-vocab { border-top: 5px solid #2a5298; }
.card-dial { border-top: 5px solid #4c6ef5; }
.card-quiz { border-top: 5px solid #fab005; }

.home-card button { width: 100%; margin-top: 15px; }

/* ====== ALPHABET & VOCAB PAGE STYLING ====== */
/* Alphabet Letters */
.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.letter-box {
    display: inline-block;
    margin: 5px;
    padding: 12px;
    border: 2px solid #4c6ef5;
    border-radius: 10px;
    cursor: pointer;
    background: white;
    transition: background 0.2s, transform 0.2s;
    font-size: 20px;
    font-weight: 600;
}

.letter-box:hover {
    background: #e7f0ff;
    transform: scale(1.1);
}

.letter-box.pop {
    transform: scale(1.2);
    background: #d0e2ff;
}

/* Flashcards */
#flashcardContainer {
    width: 350px;
    height: 200px;
    margin: 40px auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    background-color: #fff;
    color: #007bff;
    border: 4px solid #007bff;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#flashcardButtons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

#prevFlashcard, #nextFlashcard {
    padding: 14px 28px;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #007bff;
    border-radius: 12px;
    cursor: pointer;
    background-color: #fff;
    color: #007bff;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#prevFlashcard:hover, #nextFlashcard:hover {
    background-color: #007bff;
    color: #fff;
    transform: translateY(-2px);
}

#prevFlashcard:active, #nextFlashcard:active {
    transform: translateY(1px);
}

/* Category Buttons */
#categoryButtons {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

#categoryButtons button {
    padding: 8px 16px;
    border: 2px solid #4c6ef5;
    border-radius: 10px;
    background: white;
    color: #4c6ef5;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, color 0.2s;
}

#categoryButtons button:hover {
    background: #e7f0ff;
    transform: scale(1.05);
}

#categoryButtons button.active {
    background: #4c6ef5;
    color: white;
}

#categoryButtons button.pop {
    transform: scale(1.2);
    background: #d0e2ff;
    color: #4c6ef5;
}

/* Quiz Page */
.quiz-card {
  max-width: 600px;
  margin: 40px auto;
  padding: 30px 25px;
  border-radius: 20px;
  background: linear-gradient(135deg, #4c6ef5, #3b5bdb);
  color: white;
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: transform 0.2s ease;
}

.quiz-card:hover {
    transform: translateY(-5px);
}

.quiz-progress {
    font-weight: 600;
    opacity: 0.8;
}

.quiz-question {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.option-btn:hover {
    transform: scale(1.05);
    background: rgba(255,255,255,0.2);
}

.option-btn.correct {
    background: #2ecc71;
    border-color: #27ae60;
    color: white;
}

.option-btn.wrong {
    background: #e74c3c;
    border-color: #c0392b;
    color: white;
}

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

.quiz-next {
    align-self: flex-end;
    padding: 12px 25px;
    background: white;
    color: #4c6ef5;
    border: none;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.quiz-next:hover:not(:disabled) {
    transform: scale(1.05);
    background: #f0f4ff;
}

.quiz-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quiz-result {
    font-weight: 700;
    font-size: 1.2rem;
    margin-top: 15px;
    text-align: center;
    color: white;
}

/* Progress Bar for Profile Page */
.progress-bg {
  background: #e0e7ff;
  border-radius: 12px;
  height: 24px;
  width: 100%;
  margin: 20px 0;
  overflow: hidden;
}

.progress-fill {
  background: #4c6ef5;
  height: 100%;
  transition: width 0.5s ease;
}

/* Quiz Specific Layout */
.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 20px;
}

.quiz-feedback {
  font-weight: bold;
  margin-top: 15px;
  font-size: 1.1rem;
}

.quiz-correct { background-color: #2ecc71 !important; color: white !important; }
.quiz-wrong { background-color: #e74c3c !important; color: white !important; }

/* Custom Dropdown Styling */
.custom-select-wrapper {
  position: relative;
  user-select: none;
  width: 100%;
  margin: 20px 0;
}
.custom-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 25px;
  font-size: 1rem;
  font-weight: bold;
  color: #333;
  background: #f8f9fa;
  border: 2px solid #eee;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
}
.custom-select-trigger:hover {
  border-color: #4c6ef5;
  background: white;
}
.custom-options {
  position: absolute;
  display: block;
  top: 120%;
  left: 0;
  right: 0;
  border: 1px solid #eee;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-15px);
  transition: all 0.2s;
  z-index: 50;
  overflow: hidden;
}
.custom-select-wrapper.open .custom-options {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0);
}
.custom-option {
  position: relative;
  display: block;
  padding: 12px 25px;
  font-size: 0.95rem;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid #f9f9f9;
}
.custom-option:hover {
  background: #f0f8ff;
  color: #4c6ef5;
  padding-left: 35px;
}
.arrow {
  border: solid #999;
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.custom-select-wrapper.open .arrow {
  transform: rotate(-135deg);
  border-color: #4c6ef5;
}

/* Chat bubbles */
.chat-container {
  max-width: 600px;
  margin: 0 auto 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-bubble {
  padding: 15px 20px;
  border-radius: 18px;
  max-width: 80%;
  word-wrap: break-word;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chat-left {
  background: #e3f2fd;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-right {
  background: #c5e1a5;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}
/* 🎮 XP Floating Animation */
/* 🎮 Subtle Corner XP Animation */
/* 🎮 The animation that makes the XP visible and moving */
@keyframes xpFloatCorner {
0% { 
    opacity: 0; 
    transform: translateY(0); 
}
20% { 
    opacity: 1; 
    transform: translateY(-5px); 
}
100% { 
    opacity: 0; 
    transform: translateY(-40px); 
}
}
/* Pulse animation for microphone button */
@keyframes pulse {
0% {
  box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
}
70% {
  box-shadow: 0 0 0 15px rgba(231, 76, 60, 0);
}
100% {
  box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
}
}

/* Slide in animation for correct answer */
@keyframes slideIn {
from {
  opacity: 0;
  transform: translateY(20px);
}
to {
  opacity: 1;
  transform: translateY(0);
}
}
/* ═══════════════════════════════════════════════════════════════
   ENHANCED MOBILE RESPONSIVE CSS
   ═══════════════════════════════════════════════════════════════ */

/* ── Mobile nav: bottom tab bar ── */
@media (max-width: 768px) {
  nav {
    padding: 0 14px;
    height: 54px;
  }
  /* Hide all nav links except logo on mobile */
  .nav-left a:not(#homeLink) { display: none; }
  #homeLink svg { width: 28px; height: 28px; }

  /* Show bottom tab bar */
  #mobileTabBar { display: flex !important; }

  /* Push content above tab bar */
  .page { padding-bottom: 72px !important; }
  .page-content { padding: 24px 16px; }

  /* Offline banner offset */
  .offline-banner { top: 54px; }
}

@media (max-width: 480px) {
  .page { padding: 0 0 72px; min-height: calc(100vh - 54px); }
  .page-content { padding: 20px 14px; }
  
  /* Flashcard responsive */
  #flashcardContainer {
    width: 100%;
    max-width: 350px;
    height: 180px;
    font-size: 24px;
    padding: 16px;
  }
  
  /* Status bar responsive */
  .status-bar { 
    flex-direction: column; 
    gap: 10px; 
    margin: -30px auto 30px; 
  }
  .status-item { min-width: unset; width: 100%; }
  
  /* Home grid */
  .home-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 12px;
  }
  
  /* Quiz options */
  .quiz-options-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  /* Scenario grid */
  .scenario-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  /* Category buttons */
  #categoryButtons {
    gap: 6px;
  }
  #categoryButtons button {
    padding: 6px 12px;
    font-size: .72rem;
  }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
  .page { padding: 0; }
  .page-content { padding: 30px 20px; }
  .home-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
  button, .nav-btn, .letter-box, .option-btn {
    min-height: 44px;
    min-width: 44px;
  }
  .nav-left a { min-height: 40px; display: flex; align-items: center; }
}


/* ── Bottom tab bar ── */
#mobileTabBar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 58px;
  background: #07102a;
  border-top: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 -4px 24px rgba(0,0,0,.5);
  z-index: 300;
  align-items: stretch;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mob-tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: rgba(255,255,255,.35);
  font-size: .52rem; font-weight: 800;
  letter-spacing: .3px; text-transform: uppercase;
  border: none; background: none;
  padding: 6px 2px; border-radius: 0;
  box-shadow: none; min-height: unset;
  transition: color .15s;
  position: relative;
}
.mob-tab svg { width: 20px; height: 20px; flex-shrink: 0; }
.mob-tab.active { color: #fbbf24; }
.mob-tab.active::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 24px; height: 2px;
  background: #fbbf24;
  border-radius: 0 0 2px 2px;
}

/* More drawer */
#mobileMoreDrawer {
  display: none;
  position: fixed;
  bottom: 58px; left: 0; right: 0;
  background: #0d0720;
  border-top: 1px solid rgba(255,255,255,.09);
  z-index: 299;
  padding: 14px 14px 10px;
  box-shadow: 0 -8px 32px rgba(0,0,0,.5);
  animation: drawerUp .22s cubic-bezier(.22,1,.36,1);
}
#mobileMoreDrawer.open { display: block; }
@keyframes drawerUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.mob-drawer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.mob-drawer-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px; padding: 12px 4px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07) !important;
  border-radius: 14px;
  cursor: pointer; color: rgba(255,255,255,.55);
  font-size: .55rem; font-weight: 800;
  letter-spacing: .3px; text-transform: uppercase;
  transition: all .15s;
  box-shadow: none !important;
  min-height: unset !important; min-width: unset !important;
}
.mob-drawer-item:hover {
  background: rgba(124,58,237,.15) !important;
  color: #a78bfa; transform: none;
}
.mob-drawer-item svg { width: 20px; height: 20px; }
.mob-drawer-overlay {
  display: none; position: fixed; inset: 0;
  z-index: 298; background: rgba(0,0,0,.3);
}
.mob-drawer-overlay.open { display: block; }

/* Offline indicator */
.offline-banner {
  position: fixed;
  top: 62px;
  left: 0;
  right: 0;
  background: #fef3c7;
  border-bottom: 2px solid #fde68a;
  padding: 8px 16px;
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  color: #92400e;
  z-index: 199;
  display: none;
}
.offline-banner.visible { display:flex;align-items:center;justify-content:center;gap:8px; }

/* Legal footer responsive */
@media (max-width: 480px) {
  #legalFooter { padding: 18px 14px; font-size: .65rem; }
}