:root {
  --font-main: 'Quicksand', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-fun: 'Nunito', 'Quicksand', sans-serif;

  --bg: #f0f7ff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;

  --yellow: #f59e0b;
  --yellow-soft: #fef3c7;
  --green: #10b981;
  --green-soft: #d1fae5;
  --coral: #f43f5e;
  --coral-soft: #ffe4e6;
  --sky: #0ea5e9;
  --sky-soft: #e0f2fe;
  --purple: #8b5cf6;
  --purple-soft: #ede9fe;

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-full: 9999px;

  --shadow-card: 0 8px 24px rgba(79, 70, 229, 0.08);
  --shadow-btn: 0 4px 0 rgba(0, 0, 0, 0.15);
  --shadow-btn-hover: 0 2px 0 rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Confetti Overlay */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* ==================== TOPBAR ==================== */
.topbar {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-avatar-box {
  font-size: 32px;
  background: var(--yellow-soft);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #fbbf24;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  font-family: var(--font-fun);
}

.brand-title strong {
  color: var(--coral);
}

.brand-subtitle {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-full);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
}

.nav-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.nav-ico {
  font-size: 18px;
}

/* Topbar Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sound-toggle-btn {
  background: var(--surface-2);
  border: 2px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.15s;
}

.sound-toggle-btn:active {
  transform: scale(0.92);
}

.profile-chip-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 2px solid #cbd5e1;
  padding: 6px 14px 6px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: var(--font-main);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.profile-chip-btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.chip-avatar {
  font-size: 22px;
  background: var(--purple-soft);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.chip-stars {
  font-size: 13px;
  font-weight: 800;
  color: var(--yellow);
  background: var(--yellow-soft);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ==================== MAIN CONTAINER ==================== */
.main-container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 20px;
  flex: 1;
  width: 100%;
}

.pane-header {
  text-align: center;
  margin-bottom: 24px;
}

.pane-badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pane-title {
  font-family: var(--font-fun);
  font-size: 32px;
  font-weight: 900;
  color: #1e1b4b;
  margin-bottom: 6px;
}

.pane-desc {
  font-size: 15.5px;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto;
  font-weight: 600;
}

/* Mode Switcher */
.mode-switch-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.mode-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.sparkle-pill {
  font-size: 11px;
  background: var(--yellow);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Category Filter Scroll */
.category-scroll-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 24px;
  scrollbar-width: thin;
}

.cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: var(--surface);
  border: 2px solid var(--border);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.cat-btn:hover {
  transform: translateY(-2px);
  border-color: var(--sky);
}

.cat-btn.active {
  background: var(--sky-soft);
  border-color: var(--sky);
  color: #0369a1;
  font-weight: 800;
}

/* ==================== FLASHCARDS GRID ==================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.vocab-card {
  perspective: 1000px;
  height: 250px;
  cursor: pointer;
}

.vocab-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.vocab-card.flipped .vocab-card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid #e0e7ff;
  background: var(--surface);
}

.card-face.front {
  background: #ffffff;
}

.card-face.back {
  background: #fdf4ff;
  border-color: #f0abfc;
  transform: rotateY(180deg);
}

.card-emoji {
  font-size: 58px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.06));
}

.card-word {
  font-family: var(--font-fun);
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 2px;
}

.card-phonetic {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.card-sound-btn {
  background: var(--primary-soft);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: 0 3px 0 #c7d2fe;
  transition: transform 0.1s;
}

.card-sound-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #c7d2fe;
}

.card-hint-tap {
  position: absolute;
  bottom: 8px;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

.card-meaning {
  font-size: 19px;
  font-weight: 800;
  color: #a21caf;
  margin-bottom: 8px;
}

.card-example {
  font-size: 13.5px;
  color: #475569;
  font-style: italic;
  line-height: 1.4;
}

/* ==================== QUIZ SECTION ==================== */
.quiz-container {
  max-width: 640px;
  margin: 0 auto;
}

.quiz-card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-card);
}

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

.quiz-step {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.quiz-score-pill {
  font-size: 14px;
  font-weight: 800;
  color: var(--yellow);
  background: var(--yellow-soft);
  padding: 4px 14px;
  border-radius: var(--radius-full);
}

.quiz-prompt-box {
  text-align: center;
  margin-bottom: 28px;
}

.quiz-prompt-emoji {
  font-size: 72px;
  margin-bottom: 10px;
}

.quiz-prompt-question {
  font-family: var(--font-fun);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.quiz-listen-btn {
  background: var(--sky-soft);
  border: 2px solid #bae6fd;
  color: #0284c7;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.1s;
}

.quiz-listen-btn:hover {
  background: #bae6fd;
}

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

.quiz-opt-btn {
  background: #f8fafc;
  border: 3px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-fun);
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 4px 0 #cbd5e1;
  transition: all 0.15s ease;
}

.quiz-opt-btn:hover {
  background: #ffffff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.quiz-opt-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #cbd5e1;
}

.quiz-opt-btn.correct {
  background: var(--green-soft);
  border-color: var(--green);
  color: #065f46;
  box-shadow: 0 4px 0 #34d399;
}

.quiz-opt-btn.wrong {
  background: var(--coral-soft);
  border-color: var(--coral);
  color: #9f1239;
  box-shadow: 0 4px 0 #f87171;
}

.quiz-feedback-box {
  margin-top: 24px;
  text-align: center;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--green-soft);
  border: 2px solid var(--green);
}

.feedback-icon {
  font-size: 40px;
  margin-bottom: 6px;
}

.feedback-text {
  font-size: 18px;
  font-weight: 800;
  color: #065f46;
  margin-bottom: 14px;
}

.quiz-next-btn {
  background: var(--green);
  color: #ffffff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #059669;
}

.quiz-next-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #059669;
}

/* ==================== SPEAKING MODULE ==================== */
.speaking-level-bar, .grammar-level-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.speaking-lvl-btn, .grammar-lvl-btn {
  padding: 10px 20px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.speaking-lvl-btn.active, .grammar-lvl-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.speaking-arena {
  max-width: 680px;
  margin: 0 auto;
}

.mascot-card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-card);
}

.mascot-avatar-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.mascot-avatar {
  font-size: 54px;
  width: 72px;
  height: 72px;
  background: var(--yellow-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #fde68a;
  flex-shrink: 0;
}

.speech-bubble {
  background: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 700;
  color: #334155;
  position: relative;
}

.speech-bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid #f1f5f9;
}

.speaking-target-card {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}

.target-category-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  background: var(--purple-soft);
  color: var(--purple);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
}

.target-big-word {
  font-family: var(--font-fun);
  font-size: 34px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 2px;
}

.target-phonetic {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 4px;
}

.target-meaning {
  font-size: 16px;
  font-weight: 700;
  color: #0284c7;
  margin-bottom: 16px;
}

.speaking-action-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.spk-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 14.5px;
  cursor: pointer;
  box-shadow: 0 4px 0 #3730a3;
  transition: transform 0.1s;
}

.spk-audio-btn.soft {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  box-shadow: 0 3px 0 #cbd5e1;
}

.spk-audio-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #3730a3;
}

/* Big Mic Section */
.mic-section {
  text-align: center;
  margin: 30px 0;
}

.big-mic-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: 5px solid #fee2e2;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.35), 0 6px 0 #991b1b;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.big-mic-btn:hover {
  transform: scale(1.04);
}

.big-mic-btn:active {
  transform: translateY(4px) scale(0.98);
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.35), 0 2px 0 #991b1b;
}

.big-mic-btn.recording {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #d1fae5;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4), 0 6px 0 #047857;
  animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.mic-icon {
  font-size: 42px;
  margin-bottom: 2px;
}

.mic-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mic-tip {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 14px;
  font-weight: 600;
}

/* Result Card */
.speaking-result-card {
  background: var(--yellow-soft);
  border: 3px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
}

.result-stars {
  font-size: 38px;
  margin-bottom: 4px;
}

.result-headline {
  font-family: var(--font-fun);
  font-size: 20px;
  font-weight: 800;
  color: #854d0e;
  margin-bottom: 6px;
}

.result-heard {
  font-size: 14.5px;
  color: #713f12;
  margin-bottom: 12px;
}

.result-score-badge {
  display: inline-block;
  background: var(--yellow);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  padding: 4px 16px;
  border-radius: var(--radius-full);
}

.speaking-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spk-nav-btn {
  background: var(--surface-2);
  border: 2px solid var(--border);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 3px 0 #cbd5e1;
}

.spk-nav-btn.next {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 3px 0 #3730a3;
}

.spk-counter {
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
}

/* ==================== GRAMMAR (SENTENCE BUILDER) ==================== */
.grammar-arena {
  max-width: 720px;
  margin: 0 auto;
}

.builder-card {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-card);
}

.builder-prompt-box {
  background: var(--sky-soft);
  border: 2px solid #bae6fd;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
}

.builder-prompt-tag {
  font-size: 12px;
  font-weight: 800;
  color: #0369a1;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.builder-prompt-id {
  font-family: var(--font-fun);
  font-size: 24px;
  font-weight: 800;
  color: #075985;
  margin-bottom: 4px;
}

.builder-hint {
  font-size: 13.5px;
  color: #0284c7;
  font-weight: 600;
}

.sentence-tray-box {
  margin-bottom: 24px;
}

.tray-label, .bank-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sentence-tray {
  min-height: 80px;
  background: #f8fafc;
  border: 3px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.sentence-tray:empty::before {
  content: 'Ketuk balok di bawah untuk meletakkannya di sini...';
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  margin: auto;
}

.word-bank-box {
  margin-bottom: 20px;
}

.word-bank {
  min-height: 80px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Word Blocks */
.word-block {
  font-family: var(--font-fun);
  font-size: 18px;
  font-weight: 800;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
  transition: all 0.15s ease;
  user-select: none;
}

.word-block:hover {
  transform: translateY(-2px);
}

.word-block:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

.word-block.pos-sub {
  background: #dbeafe;
  color: #1e40af;
  border: 2px solid #93c5fd;
  box-shadow: 0 4px 0 #93c5fd;
}

.word-block.pos-verb {
  background: #dcfce7;
  color: #166534;
  border: 2px solid #86efac;
  box-shadow: 0 4px 0 #86efac;
}

.word-block.pos-obj {
  background: #ffedd5;
  color: #9a3412;
  border: 2px solid #fed7aa;
  box-shadow: 0 4px 0 #fed7aa;
}

.pos-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.pos-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.pos-pill.blue { background: #eff6ff; color: #1d4ed8; }
.pos-pill.green { background: #f0fdf4; color: #15803d; }
.pos-pill.orange { background: #fff7ed; color: #c2410c; }

.builder-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.gmr-btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.gmr-btn.reset {
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  color: #475569;
  box-shadow: 0 4px 0 #cbd5e1;
}

.gmr-btn.check {
  background: var(--primary);
  border: 2px solid #4338ca;
  color: #ffffff;
  box-shadow: 0 4px 0 #3730a3;
}

.gmr-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

.builder-feedback {
  margin-top: 24px;
  background: var(--green-soft);
  border: 2px solid var(--green);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

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

#grammarFeedbackTitle {
  font-family: var(--font-fun);
  font-size: 20px;
  font-weight: 800;
  color: #065f46;
  margin-bottom: 4px;
}

#grammarFeedbackDesc {
  font-size: 14.5px;
  color: #047857;
  margin-bottom: 14px;
}

.gmr-next-btn {
  background: var(--green);
  color: #ffffff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 0 #047857;
}

/* ==================== REWARDS & LEADERBOARD ==================== */
.rewards-hero-card {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 30px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 30px;
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.25);
  flex-wrap: wrap;
}

.hero-avatar-big {
  font-size: 64px;
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.4);
}

.hero-info {
  flex: 1;
}

.hero-name {
  font-family: var(--font-fun);
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 10px;
}

.hero-stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-stat-pill {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
}

.switch-profile-btn {
  background: #ffffff;
  color: var(--primary);
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
  transition: transform 0.1s;
}

.switch-profile-btn:active {
  transform: translateY(2px);
}

.section-title {
  font-family: var(--font-fun);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
}

/* Badges Grid */
.badges-section {
  margin-bottom: 30px;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.badge-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  opacity: 0.5;
  filter: grayscale(80%);
  transition: all 0.2s;
}

.badge-card.unlocked {
  opacity: 1;
  filter: none;
  border-color: #fde68a;
  background: #fffdf5;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
}

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

.badge-name {
  font-family: var(--font-fun);
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.badge-sub {
  font-size: 12px;
  color: var(--muted);
}

/* Leaderboard */
.leaderboard-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lb-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.lb-item.is-me {
  background: #eff6ff;
  border: 2px solid #93c5fd;
}

.lb-rank {
  font-family: var(--font-fun);
  font-size: 18px;
  font-weight: 900;
  width: 28px;
  color: var(--muted);
}

.lb-avatar {
  font-size: 26px;
  width: 40px;
  height: 40px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.lb-info {
  flex: 1;
}

.lb-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.lb-streak {
  font-size: 12px;
  color: var(--muted);
}

.lb-stars {
  font-size: 16px;
  font-weight: 900;
  color: var(--yellow);
}

/* ==================== MODAL ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

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

.modal-title {
  font-family: var(--font-fun);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: var(--muted);
}

.list-hint {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.profile-card-opt {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.profile-card-opt:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
}

.profile-card-opt.active {
  border-color: var(--primary);
  background: #e0e7ff;
}

.profile-opt-avatar {
  font-size: 36px;
  margin-bottom: 6px;
}

.profile-opt-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.profile-opt-stars {
  font-size: 12px;
  font-weight: 700;
  color: var(--yellow);
}

.modal-divider {
  text-align: center;
  margin: 18px 0;
  position: relative;
}

.modal-divider::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--border);
}

.modal-divider span {
  position: relative;
  background: var(--surface);
  padding: 0 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.form-title {
  font-family: var(--font-fun);
  font-size: 16.5px;
  font-weight: 800;
  margin-bottom: 12px;
}

.new-profile-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.form-input {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 14.5px;
  font-weight: 600;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avatar-opt {
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: #f8fafc;
  cursor: pointer;
}

.avatar-opt.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.08);
}

.form-submit-btn {
  background: var(--green);
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #059669;
  margin-top: 6px;
}

.form-submit-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #059669;
}

/* ==================== FOOTER ==================== */
.footer {
  background: var(--surface);
  border-top: 2px solid var(--border);
  margin-top: 40px;
  padding: 24px 20px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-copy {
  font-size: 12px;
  color: #94a3b8;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .topbar-inner {
    flex-wrap: wrap;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
    justify-content: space-around;
  }
  .nav-lbl {
    font-size: 12.5px;
  }
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .quiz-options-grid {
    grid-template-columns: 1fr;
  }
  .builder-actions {
    flex-direction: column;
  }
}
