@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Zilla+Slab:wght@500;600&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --ink: #101b33;
  --ink-2: #182545;
  --ink-3: #22315c;
  --gold: #c9a227;
  --gold-soft: #e8c766;
  --gold-rgb: 201, 162, 39;
  --parchment: #fbf6ec;
  --parchment-text: #241f14;
  --text: #f3efe3;
  --text-muted: #9aa3c0;
  --success: #7fa66c;
  --success-bg: #22331f;
  --danger: #c9694f;
  --danger-bg: #3a2119;
  --ice: #7ec8e3;
  --ice-bg: #16283a;
  --radius-lg: 22px;
  --radius-md: 14px;
  /* Telegram fullscreen rejimida o'zining tugmalari (yopish/menyu) ostiga
     tushib qolmaslik uchun Telegram bergan xavfsiz zonalar qo'shiladi. */
  --safe-top: calc(env(safe-area-inset-top, 0px) + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------------------------------------------------------------------
   🎨 "Kunduzgi" mavzu - ⚙️ Sozlamalar bo'limidan tanlanadi
   (webapp/app.js dagi applyTheme() shu <html data-theme="light"> ni
   qo'yadi). Faqat asosiy fon/matn/karta ranglari almashadi - oltin urg'u
   rangi (--gold/--gold-soft) ATAYLAB deyarli o'zgarmaydi, chunki bu
   botning "Mizan" brendini ikkala mavzuda ham tanib turishga yordam
   beradi.
   --------------------------------------------------------------------- */
:root[data-theme="light"] {
  --ink: #f4f1e8;
  --ink-2: #ffffff;
  --ink-3: #ded6bf;
  --gold: #b5872a;
  --gold-soft: #8a6318;
  --text: #241f14;
  --text-muted: #766f5c;
  --success-bg: #e3ecdc;
  --danger-bg: #f6e1da;
  --ice-bg: #dcf0f8;
}

/* ---------------------------------------------------------------------
   📜 "Klassika" rang sxemasi - foydalanuvchi Shifohiya/Mabda ul-Qiroat
   kabi klassik kitoblar bo'limida bo'lganda YOQILADI (webapp/app.js
   shu <html data-accent="classic"> ni qo'yadi/olib tashlaydi - Lug'at/
   bottom-nav ekranlariga qaytilganda darhol asl (oltin) rangga
   qaytariladi). Mavjud "Kunduzgi" mavzu (data-theme) bilan MUSTAQIL -
   ikkalasi bir vaqtda ishlashi mumkin (masalan kunduzgi + klassika).
   Faqat urg'u (--gold/--gold-soft/--gold-rgb) VA fon (--ink/-2/-3)
   ranglari almashadi - qolgan hammasi (--text, --success va h.k.)
   o'zgarmaydi, chunki 65+ joyda var(--gold) orqali ishlatilgani uchun
   butun ilova avtomatik yashilga o'tadi.
   --------------------------------------------------------------------- */
:root[data-accent="classic"] {
  --ink: #0e1f16;
  --ink-2: #163326;
  --ink-3: #1f4635;
  --gold: #4caf7a;
  --gold-soft: #7fd9a8;
  --gold-rgb: 76, 175, 122;
}

:root[data-theme="light"][data-accent="classic"] {
  --ink: #eef5ee;
  --ink-2: #ffffff;
  --ink-3: #d3e8d6;
  --gold: #1f7a4d;
  --gold-soft: #14532d;
  --gold-rgb: 31, 122, 77;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  background-image:
    radial-gradient(circle at 15% 8%, rgba(var(--gold-rgb), 0.07), transparent 40%),
    repeating-linear-gradient(45deg, rgba(var(--gold-rgb), 0.035) 0px, rgba(var(--gold-rgb), 0.035) 1px, transparent 1px, transparent 26px),
    repeating-linear-gradient(-45deg, rgba(var(--gold-rgb), 0.035) 0px, rgba(var(--gold-rgb), 0.035) 1px, transparent 1px, transparent 26px);
}

#app {
  min-height: 100vh;
  padding: calc(20px + var(--safe-top)) 18px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

.eyebrow {
  font-family: 'Zilla Slab', serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--gold-soft);
  text-transform: uppercase;
  margin: 0 0 4px;
}

.h1 {
  font-family: 'Zilla Slab', serif;
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 6px;
  color: var(--text);
}

.sub {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.local-back-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink-2);
  border: 1px solid rgba(var(--gold-rgb), 0.35);
  color: var(--gold-soft);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.local-back-btn:active {
  transform: scale(0.92);
}

.wordmark {
  font-family: 'Amiri', serif;
  font-size: 20px;
  color: var(--gold-soft);
  letter-spacing: 0.02em;
}

.streak-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--ink-2);
  border: 1px solid rgba(var(--gold-rgb), 0.35);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-soft);
}

.module-switch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: 999px;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.stat-chip {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
}

.stat-chip .num {
  font-family: 'Zilla Slab', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.stat-chip .label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

.stat-bar-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--ink-3);
  margin-top: 8px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.lesson-card {
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.lesson-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.lesson-card .title {
  font-family: 'Zilla Slab', serif;
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 4px;
}

.lesson-card .meta {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 18px;
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-gold {
  background: var(--gold);
  color: #241a00;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--ink-3);
}

.btn-ghost:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn + .btn {
  margin-top: 10px;
}

.card-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 380px;
}

.flip-card {
  width: 100%;
  max-width: 340px;
  height: 300px;
  perspective: 1200px;
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
  transform-style: preserve-3d;
}

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

.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px;
  text-align: center;
}

.flip-front {
  background: var(--parchment);
  color: var(--parchment-text);
  border: 1px solid rgba(var(--gold-rgb), 0.5);
}

.flip-front .arabic {
  font-family: 'Amiri', serif;
  font-size: 44px;
  line-height: 1.3;
  direction: rtl;
}

.flip-front .tap-hint {
  margin-top: 18px;
  font-size: 12px;
  color: #8a7f5e;
  letter-spacing: 0.04em;
}

.audio-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink-2);
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 14px;
  transition: transform 0.12s ease, background 0.12s ease;
}

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

.audio-btn.playing {
  background: var(--gold);
  color: var(--ink);
}

.audio-btn.audio-unavailable,
.big-audio-btn.audio-unavailable {
  opacity: 0.4;
  cursor: not-allowed;
}

.quiz-word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 18px 0 30px;
}

.quiz-word-row .quiz-word {
  margin: 0;
}

.quiz-word-row .audio-btn {
  width: 38px;
  height: 38px;
  font-size: 16px;
  margin-top: 0;
}

.flip-back {
  background: var(--ink-2);
  border: 1px solid var(--gold);
  transform: rotateY(180deg);
}

.flip-back .translation {
  font-family: 'Zilla Slab', serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--gold-soft);
  margin: 0 0 10px;
}

.flip-back .example {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.progress-dots {
  display: flex;
  gap: 6px;
  margin: 20px 0;
  justify-content: center;
}

.progress-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}

.progress-dots .dot.active {
  background: var(--gold);
  width: 18px;
  border-radius: 4px;
  transition: width 0.2s ease;
}

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

.quiz-counter {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.quiz-counter-retry {
  color: var(--gold-soft);
}

.quiz-word {
  font-family: 'Amiri', serif;
  font-size: 38px;
  text-align: center;
  direction: rtl;
  color: var(--gold-soft);
  margin: 18px 0 30px;
  line-height: 1.4;
}

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

.option {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.option:active {
  transform: scale(0.98);
}

.option.correct {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.option.wrong {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.option[disabled] {
  pointer-events: none;
}

.difficulty-prompt {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 12px;
}

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

.difficulty-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.difficulty-btn:active {
  transform: scale(0.96);
}

.difficulty-btn .emoji {
  font-size: 22px;
}

.difficulty-btn.hard {
  border-color: var(--danger);
}

.difficulty-btn.hard:active {
  background: var(--danger-bg);
}

.difficulty-btn.medium {
  border-color: var(--gold);
}

.difficulty-btn.medium:active {
  background: rgba(var(--gold-rgb), 0.15);
}

.difficulty-btn.easy {
  border-color: var(--success);
}

.difficulty-btn.easy:active {
  background: var(--success-bg);
}

.result-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.score-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;
}

.score-ring .ring-bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--pct) * 1%), var(--ink-3) 0);
}

.score-ring .ring-hole {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-ring .pct {
  font-family: 'Zilla Slab', serif;
  font-size: 32px;
  font-weight: 600;
}

.score-ring .frac {
  font-size: 12px;
  color: var(--text-muted);
}

.flourish {
  width: 60px;
  height: 14px;
  margin: 0 auto 16px;
  opacity: 0.6;
}

.loading-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--ink-3);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-box {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: #f0c4b8;
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--ink-3);
  padding: 10px 12px calc(10px + var(--safe-bottom));
  max-width: 480px;
  margin: 0 auto;
  z-index: 20;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 10px;
}

.nav-item .nav-icon {
  font-size: 20px;
  line-height: 1;
  position: relative;
  display: inline-block;
}

/* 🔔 "Qo'shimcha" tabidagi o'qilmagan xabar belgisi */
.nav-icon-dot {
  position: absolute;
  top: -2px;
  right: -6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d4f;
  border: 1.5px solid var(--ink);
}

.nav-item.active {
  color: var(--gold-soft);
}

.nav-item.active .nav-icon {
  transform: scale(1.08);
}

#app.has-nav {
  padding-bottom: calc(78px + var(--safe-bottom));
}

.profile-stage {
  flex: 1;
}

.profile-header {
  text-align: center;
  margin: 10px 0 24px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--gold), var(--gold-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Amiri', serif;
  font-size: 26px;
  color: var(--ink);
  margin: 0 auto 10px;
}

.profile-name {
  font-family: 'Zilla Slab', serif;
  font-weight: 600;
  font-size: 18px;
}

/* 🏆 Profildagi "eng yaxshi natijalar" (eng uzun streak, haftalik eng
   baland XP, arcade rekordi) - ism ostida, kartalar shaklida. */
.profile-best-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.profile-best-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
}

.profile-best-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.profile-best-label {
  flex: 1;
  font-size: 13px;
  color: var(--text-muted);
  text-align: left;
}

.profile-best-value {
  font-family: 'Zilla Slab', serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--gold-soft);
}

/* --- ☰ Qo'shimcha (More) --- */
.more-stage {
  flex: 1;
}

.more-profile-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin: 8px 0 16px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
}

.more-profile-avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--gold), var(--gold-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Amiri', serif;
  font-size: 18px;
  color: var(--ink);
}

.more-profile-row .more-row-label {
  font-family: 'Zilla Slab', serif;
  font-weight: 600;
  font-size: 16px;
}

.more-list {
  display: flex;
  flex-direction: column;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.more-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--ink-3);
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
}

.more-row:last-child {
  border-bottom: none;
}

.more-row-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.more-row-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}

.more-row-chevron {
  color: var(--text-muted);
  font-size: 18px;
}

.more-row-badge {
  flex-shrink: 0;
  background: var(--gold);
  color: var(--ink-1, #1a1a1a);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  min-width: 10px;
  text-align: center;
}

.big-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.big-stat-card {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
}

.big-stat-card .value {
  font-family: 'Zilla Slab', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--gold-soft);
  display: block;
}

.big-stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.accuracy-card {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 18px;
}

.accuracy-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.accuracy-ring .ring-bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--pct) * 1%), var(--ink-3) 0);
}

.accuracy-ring .ring-hole {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.accuracy-ring .ring-hole span {
  font-family: 'Zilla Slab', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--gold-soft);
}

.accuracy-card .accuracy-text .value {
  font-family: 'Zilla Slab', serif;
  font-size: 15px;
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
}

.accuracy-card .accuracy-text .label {
  font-size: 12px;
  color: var(--text-muted);
}

.mistakes-card {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  margin-top: 14px;
  width: 100%;
}

.mistakes-title {
  font-family: 'Zilla Slab', serif;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  text-align: left;
}

.mistakes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 220px;
  overflow-y: auto;
}

.mistake-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
}

.mistake-arabic {
  font-family: 'Amiri', serif;
  font-size: 17px;
  direction: rtl;
}

.mistake-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

.mistake-correct {
  color: var(--gold-soft);
  font-weight: 600;
  flex: 1;
  text-align: left;
}

.option-arabic {
  font-family: 'Amiri', serif;
  font-size: 20px;
  direction: rtl;
  text-align: center;
}

.listen-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 24px 0 30px;
}

.listen-stage .big-audio-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--ink-2);
  border: 2px solid var(--gold);
  color: var(--gold-soft);
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 10px;
}

.listen-stage .big-audio-btn:active {
  transform: scale(0.94);
}

.listen-stage .big-audio-btn.playing {
  background: var(--gold);
  color: var(--ink);
}

.listen-stage .hint {
  font-size: 12px;
  color: var(--text-muted);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.leaderboard-row.me {
  border-color: var(--gold);
  background: rgba(var(--gold-rgb), 0.1);
}

.leaderboard-row .rank {
  width: 28px;
  text-align: center;
  font-family: 'Zilla Slab', serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.leaderboard-row.me .rank {
  color: var(--gold-soft);
}

.leaderboard-level {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--gold-soft);
  background: rgba(var(--gold-rgb), 0.14);
  border: 1px solid rgba(var(--gold-rgb), 0.35);
  border-radius: 999px;
  padding: 2px 7px;
}

.leaderboard-row .name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 🥇 O'tgan hafta individual TOP-3'da tugatgan foydalanuvchi - 1
   haftalik ism rangi (toj bilan mustaqil, ikkalasi bir vaqtda bo'lishi
   mumkin). */
.leaderboard-row .name.name-top3 {
  color: var(--gold-soft);
}

.leaderboard-row .points {
  font-family: 'Zilla Slab', serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--gold-soft);
  flex-shrink: 0;
}

.leaderboard-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 40px 20px;
  line-height: 1.6;
}

.leaderboard-my-summary {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--ink-3);
}

@media (prefers-reduced-motion: reduce) {
  .flip-inner, .btn, .option { transition: none !important; }
  .spinner { animation: none; }
}

/* ---------------------------------------------------------------------
   🎯 MASHQ (arcade: 30 soniya / 1 daqiqa / Cheksiz)
--------------------------------------------------------------------- */
.pool-toggle {
  display: flex;
  gap: 8px;
  margin: 18px 0 20px;
}

/* 📜 Klassika kitob-tanlash qatori - 7 ta kitob nomi bitta qatorga
   sig'maydi, shu sabab GORIZONTAL SKROLL qiladi (flex-wrap emas) - har
   bir chip o'z tabiiy kengligini oladi, qisqartirilmaydi/siqilmaydi. */
.pool-toggle-scroll {
  display: flex;
  gap: 8px;
  margin: 18px 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.pool-toggle-scroll .pool-toggle-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.pool-toggle-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--ink-3);
  background: var(--ink-2);
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pool-toggle-btn.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(var(--gold-rgb), 0.12);
}

/* 🎛 Mashq havzalari - ON/OFF tugmalar (Shaxsiy to'plam / O'rganilgan /
   Barcha so'zlar). Har biri to'liq kenglikdagi qator: chapda nom, o'ngda
   yoqilgan/o'chirilgan holatni ko'rsatuvchi "tumbler". */
.pool-switches {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0 8px;
}

.pool-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--ink-3);
  background: var(--ink-2);
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.pool-switch.on {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(var(--gold-rgb), 0.12);
}

.pool-switch-track {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--ink-3);
  transition: background 0.15s ease;
}

.pool-switch.on .pool-switch-track {
  background: var(--gold);
}

.pool-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.pool-switch.on .pool-switch-knob {
  transform: translateX(16px);
}

/* 📚 Shaxsiy to'plam tablari (1-to'plam / 2-to'plam...) - Mashq va
   "Shaxsiy to'plamim" ekranlarida bir xil. */
.pool-toggle--collections {
  margin: 0 0 4px;
}

.pool-tab-count {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  opacity: 0.7;
}

/* 📚 Mashq havzasi dropdown'lari (Shaxsiy to'plam / Barcha so'zlar kitobi) -
   tegishli ON/OFF qatorning tagida ochiladi. */
.pool-select-wrap {
  position: relative;
}

.pool-select-wrap::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -6px;
  border-right: 2px solid var(--gold-soft);
  border-bottom: 2px solid var(--gold-soft);
  transform: rotate(45deg);
  pointer-events: none;
}

.pool-select {
  width: 100%;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  padding: 11px 38px 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--gold);
  background: rgba(var(--gold-rgb), 0.08);
  color: var(--gold-soft);
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  outline: none;
}

.pool-select:focus {
  background: rgba(var(--gold-rgb), 0.14);
}

.pool-select option {
  background: var(--ink-2);
  color: var(--text);
}

.pool-hint {
  min-height: 16px;
  margin: 0 0 6px;
  font-size: 12px;
  color: #e05252;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pool-hint.show {
  opacity: 1;
}

.pool-note {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.practice-content-wrap {
  padding-bottom: 90px;
}

.practice-section-title {
  font-family: 'Amiri', serif;
  font-size: 15px;
  color: var(--gold-soft);
  margin: 20px 0 10px;
}

.practice-modes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.practice-mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border: 1px solid var(--ink-3);
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
}

.practice-mode-card:active {
  transform: scale(0.98);
}

.practice-mode-card--soon {
  opacity: 0.55;
  cursor: default;
}

.practice-mode-card--soon:active {
  transform: none;
}

.practice-mode-soon-badge {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--ink-3);
  border-radius: 999px;
  padding: 3px 9px;
}

.practice-mode-icon {
  font-size: 24px;
}

.practice-mode-title {
  font-family: 'Amiri', serif;
  font-size: 18px;
  color: var(--gold-soft);
}

.practice-mode-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.practice-mode-record {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-soft);
}

.practice-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}

.practice-timer-badge,
.practice-score-badge {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--gold-soft);
}

.practice-lives {
  font-size: 15px;
  letter-spacing: 2px;
}

.practice-new-record {
  margin-top: 14px;
  text-align: center;
  color: var(--gold-soft);
  font-weight: 700;
  font-size: 14px;
}

/* ---------------------------------------------------------------------
   🧊 Streak Freeze / 🎯 Kunlik maqsad / 🧩 Qiyin so'zlar / 🏅 Nishonlar
   --------------------------------------------------------------------- */

.hidden {
  display: none !important;
}

.topbar-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.freeze-pill {
  color: var(--ice);
  border-color: rgba(126, 200, 227, 0.35);
}

.difficulty-prompt.difficulty-result {
  color: var(--gold-soft);
  font-weight: 700;
  font-size: 14px;
}

.freeze-banner {
  margin: 0 0 18px;
  padding: 12px 16px;
  background: var(--ice-bg);
  border: 1px solid rgba(126, 200, 227, 0.35);
  border-radius: var(--radius-md);
  color: var(--ice);
  font-size: 13px;
  font-weight: 600;
  max-width: 320px;
}

/* ---------------------------------------------------------------------
   🏅🎉 Nishon bayrami - yangi nishon qo'lga kiritilganda natija ekrani
   ustida chiqadigan bayramona overlay (webapp/app.js#showBadgeCelebration).
   --------------------------------------------------------------------- */
.badge-celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 10, 22, 0.74);
  animation: badge-overlay-in 0.25s ease-out;
}

.badge-celebration-overlay.closing {
  animation: badge-overlay-out 0.2s ease-in forwards;
}

@keyframes badge-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes badge-overlay-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.badge-celebration-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 340px;
  text-align: center;
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 34px 24px 26px;
  box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.18), 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: badge-card-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes badge-card-pop {
  0% { transform: scale(0.7); opacity: 0; }
  60% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.badge-celebration-kicker {
  margin: 0 0 6px;
  font-family: 'Zilla Slab', serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.badge-celebration-emoji {
  font-size: 62px;
  line-height: 1;
  margin: 10px 0 14px;
  animation: badge-emoji-bounce 1.1s ease-in-out infinite;
}

@keyframes badge-emoji-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.08); }
}

.badge-celebration-title {
  margin: 0 0 8px;
  font-family: 'Zilla Slab', serif;
  font-size: 22px;
  color: var(--text);
}

.badge-celebration-desc {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.badge-celebration-tag {
  margin: 0 0 20px;
  font-size: 12px;
  color: var(--gold-soft);
}

.confetti-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 13px;
  opacity: 0.9;
  border-radius: 2px;
  animation-name: confetti-fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

.confetti-piece-wide {
  width: 10px;
  height: 8px;
  border-radius: 50%;
}

@keyframes confetti-fall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(420px) rotate(540deg); opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
  .badge-celebration-emoji { animation: none; }
  .confetti-piece { animation: none; display: none; }
  .badge-celebration-card { animation: none; }
  .badge-celebration-overlay { animation: none; }
}

/* --- 🎯 Kunlik maqsad kartasi (Home) --- */
.goal-card {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.goal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.goal-card-title {
  font-family: 'Zilla Slab', serif;
  font-size: 14px;
  font-weight: 600;
}

.goal-edit-btn {
  background: none;
  border: none;
  font-size: 15px;
  padding: 4px;
  cursor: pointer;
  opacity: 0.75;
}

.goal-edit-btn:active {
  opacity: 1;
}

.goal-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--ink-3);
  overflow: hidden;
}

.goal-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.goal-progress-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

.goal-picker {
  display: none;
  gap: 8px;
  margin-top: 12px;
}

.goal-picker.open {
  display: flex;
}

/* --- 🎯 Bugungi vazifa (Daily Quest) kartasi qo'shimcha stillari - qolgan
   qismi .goal-card klassini qayta ishlatadi (bosh sahifadagi eski
   "Kunlik maqsad" kartasi bilan bir xil ramka/joylashuv) --- */
.quest-card-title-text {
  font-family: 'Zilla Slab', serif;
  font-size: 15px;
  font-weight: 600;
  margin: 2px 0 6px;
}

.quest-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.quest-card-done {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
}

/* ---------------------------------------------------------------------
   🏅🏆 Bosh sahifadagi motivatsion kartalar - "Keyingi nishon" va
   "Reyting", ikki ustunli, yonma-yon (`.motivation-row` ichida).
   Ikkalasi ham bir xil `.rank-card`ga o'xshash tuzilishga ega:
   yuqorida emoji+qiymat, pastda tushuntiruvchi matn (va nishon
   kartasida - progress-bar).
   --------------------------------------------------------------------- */
.motivation-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.nearest-badge-card,
.rank-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  cursor: pointer;
}

.nearest-badge-card:active,
.rank-card:active {
  transform: scale(0.98);
}

.rank-card.rank-first {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(var(--gold-rgb), 0.18), var(--ink-2));
}

.rank-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-card-emoji {
  font-size: 22px;
}

.rank-card-value {
  font-family: 'Zilla Slab', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-soft);
}

.rank-card-label {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.nearest-badge-track {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--ink-3);
  overflow: hidden;
}

.nearest-badge-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.goal-pick-btn {
  flex: 1;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 8px;
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.goal-pick-btn.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(var(--gold-rgb), 0.12);
}

/* --- 🧩 Qiyin so'zlarim --- */
.weak-words-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.notification-row.unread {
  border-color: var(--gold);
  background: rgba(var(--gold-rgb), 0.08);
}

.notification-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1.4;
}

.notification-body {
  min-width: 0;
  flex: 1;
}

.notification-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px;
}

.notification-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* 🔔 Yopiq holatda 2 qatorgacha qisqartirilgan matn, bosilganda to'liq
   ochiladi - kimdan (title) va matn qismi (body) doim ko'rinadi. */
.notification-row.expandable {
  cursor: pointer;
}

.notification-row.expandable .notification-text {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notification-row.expandable.expanded .notification-text {
  -webkit-line-clamp: unset;
  display: block;
}

.notification-chevron {
  flex-shrink: 0;
  align-self: center;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1.4;
  transition: transform 0.15s ease;
}

.notification-row.expanded .notification-chevron {
  transform: rotate(90deg);
}

.notification-intro {
  border-color: var(--gold);
  background: rgba(var(--gold-rgb), 0.06);
  margin-bottom: 4px;
}

/* 🎁 Sovg'a-karta paneli - "Xabarlar" ro'yxatidagi bitta xabar ichida. */
.gift-panel {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.gift-card {
  flex: 1;
  aspect-ratio: 3 / 4;
  max-height: 64px;
  border: none;
  border-radius: var(--radius-sm, 10px);
  background: linear-gradient(160deg, rgba(var(--gold-rgb), 0.35), rgba(var(--gold-rgb), 0.12));
  border: 1.5px solid rgba(var(--gold-rgb), 0.5);
  color: var(--gold-soft);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.gift-card:active {
  transform: scale(0.94);
}

.gift-card:disabled {
  opacity: 0.5;
  cursor: default;
}

.gift-panel-opened {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm, 10px);
  background: rgba(var(--gold-rgb), 0.14);
  border: 1px solid rgba(var(--gold-rgb), 0.4);
  color: var(--gold-soft);
  font-size: 13px;
  font-weight: 600;
}

.gift-panel-expired {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm, 10px);
  background: var(--ink-3);
  color: var(--text-muted);
  font-size: 13px;
}

.weak-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.weak-word-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.weak-word-arabic {
  font-family: 'Amiri', serif;
  font-size: 18px;
  direction: rtl;
}

.weak-word-translation {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weak-word-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 999px;
  padding: 4px 9px;
}

/* --- Profil bo'limi qo'shimcha havolalari --- */
.profile-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.profile-links .btn {
  font-size: 13px;
  padding: 12px 8px;
}

/* --- 🏅 Nishonlar --- */
.badges-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.badge-card {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.badge-card.earned {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.14), var(--ink-2));
}

.badge-card.locked {
  opacity: 0.5;
  filter: grayscale(0.5);
}

.badge-emoji {
  font-size: 28px;
  margin-bottom: 4px;
}

.badge-title {
  font-family: 'Zilla Slab', serif;
  font-size: 13px;
  font-weight: 600;
}

.badge-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.badge-progress {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-soft);
}

/* ---------------------------------------------------------------------
   🧩 Juftlash (matching) o'yini
   --------------------------------------------------------------------- */
.matching-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.matching-meta .matching-timer {
  color: var(--gold-soft);
}

.matching-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding-bottom: 90px;
}

.matching-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.matching-tile {
  background: linear-gradient(180deg, #2f7d4a, #1f5c35);
  border: 1px solid #3a9159;
  color: #eafaf0;
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
  word-break: break-word;
}

.matching-tile.arabic {
  font-family: 'Amiri', serif;
  font-size: 20px;
}

.matching-tile:active {
  transform: scale(0.96);
}

.matching-tile.selected {
  border-color: #e8c766;
  background: linear-gradient(180deg, #d9a916, #b98a0f);
  color: #241a02;
}

.matching-tile.matched {
  border-color: var(--ink-3);
  background: var(--ink-2);
  color: var(--text-muted);
  cursor: default;
  opacity: 0.5;
}

.matching-tile.wrong-flash {
  border-color: #d64545;
  background: rgba(214, 69, 69, 0.85);
  color: #fff;
}

/* ---------------------------------------------------------------------
   🔤 Yig'ish (harflardan so'z tuzish) o'yini
   --------------------------------------------------------------------- */
.buildword-progress {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 8px 0 4px;
}

.buildword-translation {
  font-family: 'Zilla Slab', serif;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  margin: 10px 0 20px;
}

.buildword-slots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  direction: rtl;
}

.buildword-slot {
  width: 42px;
  height: 48px;
  border-bottom: 3px solid var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Amiri', serif;
  font-size: 24px;
}

.buildword-slot.filled {
  border-color: var(--gold);
}

.buildword-tiles {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  direction: rtl;
}

.buildword-tile {
  width: 46px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(180deg, #2f7d4a, #1f5c35);
  border: 1px solid #3a9159;
  color: #eafaf0;
  font-family: 'Amiri', serif;
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.buildword-tile:active {
  transform: scale(0.94);
}

.buildword-tile.used {
  opacity: 0;
  pointer-events: none;
}

.buildword-tile.selected {
  border-color: #e8c766;
  background: linear-gradient(180deg, #d9a916, #b98a0f);
  color: #241a02;
}

.buildword-tile.wrong-flash {
  border-color: #d64545;
  background: rgba(214, 69, 69, 0.85);
  color: #fff;
}

.buildword-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

/* ---------------------------------------------------------------------
   ⚙️ SOZLAMALAR bo'limi
   --------------------------------------------------------------------- */
.settings-section {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.settings-section-title {
  font-family: 'Amiri', serif;
  font-size: 15px;
  color: var(--gold-soft);
  margin: 0 0 12px;
}

.settings-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

.settings-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-choice-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-choice-btn {
  width: 100%;
  text-align: left;
}

.settings-choice-btn {
  flex: 1 1 auto;
  min-width: 76px;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.settings-choice-btn.active {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  border-color: var(--gold);
  color: #241a02;
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.settings-toggle-row input[type="checkbox"] {
  width: 44px;
  height: 26px;
  accent-color: var(--gold);
  cursor: pointer;
}

.settings-textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 10px 12px;
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  resize: vertical;
}

/* ---------------------------------------------------------------------
   📝 SHAXSIY TO'PLAM (Profil > "Shaxsiy to'plamim")
   --------------------------------------------------------------------- */
.personal-words-count {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.personal-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.personal-word-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.personal-word-arabic {
  font-family: 'Amiri', serif;
  font-size: 18px;
  direction: rtl;
}

.personal-word-translation {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.personal-word-delete {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.personal-word-delete:active {
  background: var(--danger-bg);
}

.personal-words-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.personal-word-add-form {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.personal-word-add-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.personal-word-add-form input[type="text"] {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 12px 14px;
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
}

.personal-word-add-form input[dir="rtl"] {
  font-family: 'Amiri', serif;
  font-size: 17px;
}

.personal-import-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.personal-import-row input[type="file"] {
  display: none;
}

.personal-words-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 30px 20px;
  line-height: 1.6;
}

.personal-import-status {
  font-size: 12px;
  color: var(--text-muted);
  margin: -8px 0 16px;
}

/* ---------------------------------------------------------------------
   👥 JAMOA (Clan) tizimi - Reyting ekranidagi "Jamoa" tabi
   --------------------------------------------------------------------- */
.lb-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 18px;
}

.lb-tab {
  flex: 1;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--ink-3);
  background: var(--ink-2);
  color: var(--text-muted);
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.lb-tab.active {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(var(--gold-rgb), 0.12);
}

.team-card {
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.team-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.team-card-name {
  font-family: 'Zilla Slab', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.team-card-league {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-soft);
  background: rgba(var(--gold-rgb), 0.14);
  border: 1px solid rgba(var(--gold-rgb), 0.35);
  border-radius: 999px;
  padding: 3px 10px;
}

.team-card-crowns {
  font-size: 15px;
  margin: 6px 0;
}

.team-invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--ink-3);
  font-size: 13px;
}

.team-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.team-member-name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-member-points {
  color: var(--gold-soft);
  font-weight: 700;
  flex-shrink: 0;
}

.team-member-kick {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
}

.team-browse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.team-browse-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.team-browse-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-browse-meta {
  font-size: 11px;
  color: var(--text-muted);
}


.mascot-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: none;
}

.mascot-img {
  width: 220px;
  height: auto;
  opacity: 0;
  transform: scale(0.7) translateY(30px);
  animation: mascotEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.mascot-img.breathing {
  animation: mascotBreathe 2.2s ease-in-out infinite;
}

@keyframes mascotEnter {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes mascotBreathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

.mascot-img.leaving {
  animation: mascotLeave 0.4s ease-in forwards;
}

@keyframes mascotLeave {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.85) translateY(15px); }
}


/* ---------------------------------------------------------------------
   Do'st taklif qilish - voqealar jurnali (Profil -> Referral ekrani)
   --------------------------------------------------------------------- */
.referral-event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.referral-event-main {
  flex: 1;
  min-width: 0;
}

.referral-event-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.referral-event-stage {
  color: var(--text-muted);
  font-size: 12px;
}

.referral-event-xp {
  color: var(--gold-soft);
  font-weight: 700;
  flex-shrink: 0;
}

.referral-events-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 18px 0;
}

.referral-events-title {
  font-weight: 700;
  margin: 20px 0 10px;
}


/* ---------------------------------------------------------------------
   Shaxsiy to'plam - ko'p tanlab o'chirish / hammasini o'chirish
   --------------------------------------------------------------------- */
.personal-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-danger {
  background: #7a1f1f;
  color: #fff;
  border: 1px solid #9c2b2b;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.personal-delete-all-btn {
  color: #e57373;
}

.personal-word-checkbox {
  width: 18px;
  height: 18px;
  margin-right: 4px;
  flex-shrink: 0;
}


.team-subtabs {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.team-subtab {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius-md, 10px);
  border: 1px solid var(--ink-3);
  background: var(--ink-2);
  color: var(--text-secondary, #99a);
  font-size: 13px;
}

.team-subtab.active {
  background: var(--gold-soft);
  color: #16213a;
  font-weight: 700;
  border-color: var(--gold-soft);
}

.league-view {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.league-side-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 68px;
  flex-shrink: 0;
}

.league-side-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  border-radius: 0 10px 10px 0;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text-secondary, #99a);
  font-size: 11px;
}

.league-side-tab.active {
  background: var(--ink-2);
  border-left-color: var(--gold-soft);
  color: #fff;
  font-weight: 700;
}

.league-side-tab-name {
  line-height: 1.2;
}

.league-side-tab-mine {
  font-size: 9px;
  color: var(--gold-soft);
}

.league-view-list {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/*  Daraja progress-bar (doira) - bosh sahifadagi dars kartasida,
   o'ng tomonda. Joriy CEFR darajasida necha foiz dars tugatilganini
   ko'rsatadi (backend: TodayWordsOut.level_progress_percent). */
.lesson-card {
  position: relative;
}

.level-progress-ring {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 52px;
  height: 52px;
}

.level-progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.level-progress-ring .ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 4;
}

.level-progress-ring .ring-fill {
  fill: none;
  stroke: #c9a227;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 138.2;
  stroke-dashoffset: 138.2;
  transition: stroke-dashoffset 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.level-progress-ring .ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #f2e6c4;
}

/*  Profil - ismni tahrirlash (Profil bo'limi, ism yonidagi qalam) */
.profile-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.name-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  opacity: 0.75;
  padding: 4px;
  line-height: 1;
}

.name-edit-btn:active {
  opacity: 1;
}

.name-edit-input {
  font-family: 'Zilla Slab', serif;
  font-size: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(var(--gold-rgb), 0.4);
  border-radius: 8px;
  padding: 6px 10px;
  color: inherit;
  max-width: 200px;
}

.name-edit-save,
.name-edit-cancel {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
}


/* ---------------------------------------------------------------------
   Jamoa/Liga - "Jamoam" / "Liga reytingi" subtab'lari va dropdown
   liga tanlovi. Urg'u rangi ATAYLAB zumrad/teal (#14b8a6) - oltin
   (gold) rangi botda XP/yutuq uchun band, bu yerda navigatsion
   elementlar sifatida ajratib turish uchun boshqa rang tanlandi.
   --------------------------------------------------------------------- */
.team-subtabs {
  display: flex;
  gap: 8px;
  margin: 14px 0 16px;
}

.team-subtab {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #253449;
  background: #16202e;
  color: #8a99ac;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.team-subtab.active {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: #06201c;
  font-weight: 700;
  border-color: #14b8a6;
  box-shadow: 0 2px 10px rgba(20, 184, 166, 0.25);
}

.league-select-wrap {
  position: relative;
  margin-bottom: 14px;
}

.league-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #2a3b52;
  background: #182536;
  color: #e8edf3;
}

.league-select-current {
  font-size: 17px;
  font-weight: 700;
  color: #5eead4;
}

.league-select-current-latin {
  font-size: 12px;
  color: #8a99ac;
  flex: 1;
  text-align: left;
}

.league-select-chevron {
  font-size: 10px;
  color: #5eead4;
}

.league-dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #182536;
  border: 1px solid #2a3b52;
  border-radius: 12px;
  overflow: hidden;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.league-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid #223045;
  background: transparent;
  color: #cdd6e0;
  font-size: 15px;
  text-align: left;
}

.league-dropdown-item:last-child {
  border-bottom: none;
}

.league-dropdown-item.selected {
  background: rgba(20, 184, 166, 0.14);
  color: #5eead4;
  font-weight: 700;
}

.league-dropdown-item-latin {
  font-size: 12px;
  color: #8a99ac;
  flex: 1;
}

.league-dropdown-item-mine {
  font-size: 10px;
  background: #d4a94a;
  color: #2a1d05;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
}

.league-rows-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}


.league-rows-skeleton {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skeleton-row {
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(90deg, #182536 25%, #1f2e42 37%, #182536 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}


/* ---------------------------------------------------------------------
   Profil - ism tahrirlash (qalam belgisi)
   --------------------------------------------------------------------- */
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.profile-name-edit-btn {
  border: none;
  background: transparent;
  font-size: 15px;
  padding: 4px;
  opacity: 0.75;
  line-height: 1;
}

.profile-name-edit-btn:active {
  opacity: 1;
}

.profile-name-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
}

.profile-name-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #2a3b52;
  background: #16202e;
  color: #e8edf3;
  font-size: 16px;
  text-align: center;
}

.profile-name-save-btn,
.profile-name-cancel-btn {
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
}

.profile-name-save-btn {
  background: #14b8a6;
  color: #06201c;
}

.profile-name-cancel-btn {
  background: #2a3b52;
  color: #cdd6e0;
}

/* ---------------------------------------------------------------------
   💬 UMUMIY CHAT (Qo'shimcha > Chat) - bitta xona, faqat matn.
   Ranglar mavjud tokenlardan olinadi (--ink-*, --gold, --text), shuning
   uchun Kunduzgi mavzu va Klassika (yashil) rang sxemasida ham to'g'ri
   ko'rinadi. Yuqori/pastki bo'shliqlar (#app padding) hisobga olingan.
   --------------------------------------------------------------------- */
.chat-stage {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px - var(--safe-top) - var(--safe-bottom));
  height: calc(100dvh - 48px - var(--safe-top) - var(--safe-bottom));
}

.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-msg.mine {
  align-items: flex-end;
}

.chat-bubble {
  max-width: 86%;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: 14px 14px 14px 4px;
  padding: 8px 12px;
  cursor: pointer;
}

.chat-msg.mine .chat-bubble {
  background: rgba(var(--gold-rgb), 0.14);
  border-color: rgba(var(--gold-rgb), 0.45);
  border-radius: 14px 14px 4px 14px;
}

.chat-msg.selected .chat-bubble {
  border-color: var(--gold);
}

.chat-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-soft);
  margin-bottom: 2px;
}

.chat-admin-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: var(--gold);
  color: #1a1a1a;
  border-radius: 6px;
  padding: 1px 6px;
  vertical-align: middle;
}

.chat-reply-quote {
  display: flex;
  flex-direction: column;
  border-left: 3px solid var(--gold);
  padding: 2px 8px;
  margin: 2px 0 6px;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
}

.chat-reply-quote span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-text {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-time {
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
}

.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  max-width: 92%;
}

.chat-msg.mine .chat-actions {
  justify-content: flex-end;
}

.chat-action-btn {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: 999px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
}

.chat-action-btn.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.chat-action-btn:active {
  opacity: 0.7;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  padding: 40px 10px;
}

.chat-reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 6px 10px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.chat-reply-preview[hidden] {
  display: none;
}

.chat-reply-preview-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-reply-preview-body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-reply-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-top: 8px;
}

.chat-input {
  flex: 1;
  resize: none;
  max-height: 96px;
  background: var(--ink-2);
  color: var(--text);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
}

.chat-input:focus {
  border-color: var(--gold);
}

.chat-send-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--gold);
  color: #1a1a1a;
  font-size: 18px;
  cursor: pointer;
}

.chat-send-btn:disabled {
  opacity: 0.5;
}

.chat-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  min-height: 16px;
  padding-top: 4px;
}

.chat-hint.error {
  color: var(--danger);
  text-align: left;
}

.chat-muted-note {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  margin-top: 8px;
}

.chat-rules-card {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.chat-rules-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.55;
}

.chat-rules-list li + li {
  margin-top: 8px;
}


/* =====================================================================
   🗺 YANGI BOSH SAHIFA - Kunlik zanjir + xarita + yumaloq tugmalar
   (webapp/app.js: renderMapHome). Rang tokenlari --gold/--ink o'zgaruvchilari
   orqali Klassika (yashil) va Kunduzgi mavzuga avtomatik moslashadi.
   ===================================================================== */
:root { --map-teal: #2dd4bf; --map-locked: #5b6b94; }

.home-book-chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-soft);
  max-width: 84px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Kunlik zanjir kartasi --- */
.chain-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 14px 14px 14px 16px;
  margin-bottom: 14px;
}
.chain-main { flex: 1; min-width: 0; }
.chain-title { font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 19px; color: var(--text); }
.chain-sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 12px; }
.chain-steps { display: flex; align-items: flex-start; }
.chain-step { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 54px; }
.chain-dot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--ink-3);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.chain-step.is-done .chain-dot { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.chain-step-label { font-size: 11px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.chain-link { flex: 1; height: 2px; background: var(--ink-3); margin-top: 12px; min-width: 8px; }
.chain-chest { width: 74px; flex: none; opacity: 0.9; filter: drop-shadow(0 0 10px rgba(var(--gold-rgb), 0.35)); }
.chain-chest-svg { width: 100%; height: auto; display: block; }
.chest-lid, .chest-body { fill: #1d2b52; stroke: var(--gold); stroke-width: 1.6; }
.chest-band { fill: var(--gold); }
.chest-lock { fill: var(--gold-soft); }
.chest-key { fill: #1d2b52; }

/* --- Xarita kartasi + 3 ko'rsatkich --- */
.map-card {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 10px;
  margin-bottom: 16px;
}
.map-indicators { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.map-ind {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: 14px;
  padding: 8px 4px;
  min-height: 74px;
  color: var(--text);
  font-family: 'Manrope', sans-serif;
}
button.map-ind { cursor: pointer; }
.map-ind-ring { flex-direction: row; gap: 8px; padding: 8px; }
.home-ring {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--map-teal) calc(var(--pct) * 1%), var(--ink-3) 0);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.home-ring::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--ink); }
.home-ring b { position: relative; font-size: 12px; font-weight: 700; }
.map-ind-text { font-size: 11px; color: var(--text-muted); line-height: 1.25; text-align: left; }
.map-ind-emoji { font-size: 20px; line-height: 1; }
.map-ind-value { font-size: 17px; font-weight: 700; line-height: 1.1; }
.map-ind-cap { font-size: 11px; color: var(--text-muted); }

/* --- Xaritaning o'zi --- */
.home-map {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  overflow: hidden;
  background: #0b1430;
}
.home-map-bg {
  position: absolute; inset: 0;
  background: url('map-bg.webp') center / cover no-repeat;
}
/* Klassika: tungi ko'k fon yashil tusga bo'yaladi (alohida yashil rasm
   tayyor bo'lguncha vaqtinchalik yechim). */
:root[data-accent="classic"] .home-map-bg::after {
  content: ''; position: absolute; inset: 0;
  background: #1f7a4d; mix-blend-mode: color; opacity: 0.9;
}
.map-path { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-path path { fill: none; stroke-linecap: round; }
.map-path-grey { stroke: rgba(150, 165, 205, 0.55); stroke-width: 0.8; stroke-dasharray: 0.1 2.2; }
.map-path-gold { stroke: var(--gold); stroke-width: 1.1; filter: drop-shadow(0 0 1.2px rgba(var(--gold-rgb), 0.9)); }

.map-stage-pill {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px;
  background: rgba(10, 18, 40, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 2px 4px;
  z-index: 3;
  backdrop-filter: blur(4px);
}
.map-stage-label { font-size: 12px; font-weight: 700; color: #f3efe3; padding: 0 6px; }
.map-stage-arrow {
  width: 26px; height: 26px; border: none; background: none;
  color: #f3efe3; font-size: 20px; line-height: 1; cursor: pointer; border-radius: 50%;
}
.map-stage-arrow:disabled { opacity: 0.25; cursor: default; }

.map-node {
  position: absolute; transform: translate(-50%, -50%);
  background: none; border: none; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  font-family: 'Manrope', sans-serif;
  z-index: 2;
}
.map-node-disc {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid transparent;
}
.map-node-disc svg { width: 20px; height: 20px; display: block; }
.map-node-label {
  position: absolute; top: 100%; margin-top: 1px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap; color: #eef0f8;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.8);
}
.map-node-sub {
  position: absolute; top: calc(100% + 13px);
  font-size: 9.5px; font-weight: 700; white-space: nowrap; color: var(--gold-soft);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}
.map-node.is-done .map-node-disc {
  background: var(--gold); border-color: var(--gold-soft); color: #1b1606;
  box-shadow: 0 0 8px rgba(var(--gold-rgb), 0.55);
}
.map-node.is-locked .map-node-disc {
  background: rgba(60, 74, 120, 0.85); border-color: var(--map-locked); color: #9fb0dc;
}
.map-node.is-locked .map-node-label { color: #a9b4d6; font-weight: 600; }
.map-node.is-current .map-node-disc {
  width: 46px; height: 46px;
  background: #1b1606; border: 3px solid var(--gold); color: var(--gold-soft);
  box-shadow: 0 0 0 5px rgba(var(--gold-rgb), 0.18), 0 0 22px rgba(var(--gold-rgb), 0.85);
  animation: mapPulse 2s ease-in-out infinite;
}
.map-node.is-current .map-node-disc svg { width: 24px; height: 24px; }
.map-node.is-current .map-node-label { font-size: 12px; color: #fff; }
@keyframes mapPulse {
  0%, 100% { box-shadow: 0 0 0 5px rgba(var(--gold-rgb), 0.18), 0 0 18px rgba(var(--gold-rgb), 0.7); }
  50% { box-shadow: 0 0 0 8px rgba(var(--gold-rgb), 0.10), 0 0 28px rgba(var(--gold-rgb), 0.95); }
}
@media (prefers-reduced-motion: reduce) { .map-node.is-current .map-node-disc { animation: none; } }

/* 🕌 Bosqichning oxirgi darsi - gumbaz tugun */
.map-node.is-dome .map-node-disc {
  width: 54px; height: 54px; border-width: 2px;
  background: rgba(14, 22, 48, 0.88);
}
.map-node.is-dome .map-node-disc svg { width: 40px; height: 40px; }
.dome-svg .dome-body { fill: currentColor; stroke: none; }
.dome-svg .dome-moon { fill: currentColor; }
.dome-svg .dome-line { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; fill: none; }
.dome-svg .dome-door { fill: rgba(14, 22, 48, 0.9); }
.map-node.is-dome.is-locked .map-node-disc { background: rgba(48, 60, 100, 0.85); border-color: var(--map-locked); color: #8392bf; }
.map-node.is-dome.is-done .map-node-disc { background: rgba(27, 22, 6, 0.9); border-color: var(--gold); color: var(--gold-soft); box-shadow: 0 0 14px rgba(var(--gold-rgb), 0.75); }
.map-node.is-dome.is-current .map-node-disc { background: rgba(27, 22, 6, 0.92); color: var(--gold-soft); width: 62px; height: 62px; }
.map-node.is-dome.is-current .map-node-disc svg { width: 46px; height: 46px; }

/* --- 3 ta yumaloq tugma --- */
.round-actions { display: flex; justify-content: space-around; align-items: flex-start; margin-bottom: 8px; }
.round-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer; color: var(--text);
  font-family: 'Manrope', sans-serif; padding: 0;
}
.round-circle {
  position: relative;
  width: 78px; height: 78px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-2);
  border: 3px solid var(--map-teal);
  color: var(--map-teal);
  box-shadow: 0 0 14px rgba(45, 212, 191, 0.25);
}
.round-circle svg { width: 36px; height: 36px; display: block; }
.round-learn .round-circle {
  width: 88px; height: 88px;
  border-color: var(--gold); color: var(--gold-soft);
  box-shadow: 0 0 20px rgba(var(--gold-rgb), 0.45);
}
.round-learn .round-circle svg { width: 42px; height: 42px; }
.round-label { font-size: 14px; font-weight: 700; }
.round-btn.is-off { opacity: 0.45; }
.round-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
  background: #ff4d5e; color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink);
}

/* --- Pastki navigatsiya: yangi 4 tab, svg ikonlar --- */
.nav-item .nav-icon svg { width: 24px; height: 24px; display: block; }
.nav-item { min-width: 64px; }
.nav-item.active { position: relative; }
.nav-item.active::after {
  content: ''; position: absolute; bottom: -6px; left: 14%; right: 14%;
  height: 3px; border-radius: 2px; background: var(--gold);
}
.map-home { display: block; }

/* CEFR | Klassika almashtirgich (emoji o'rniga modul nomlari) */
.module-switch-btn.module-switch-seg {
  width: auto; height: auto; padding: 3px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 2px;
  font-family: 'Manrope', sans-serif; font-size: 11.5px; font-weight: 700;
}
.module-switch-seg .seg { padding: 5px 10px; border-radius: 999px; color: var(--text-muted); }
.module-switch-seg .seg.on { background: var(--gold); color: var(--ink); }

/* Bosh sahifa: markazdagi almashtirgich + ixchamroq ko'rsatkichlar */
.topbar.topbar-center { justify-content: center; margin-bottom: 10px; }
.map-indicators { gap: 6px; margin-bottom: 8px; }
.map-ind { min-height: 54px; padding: 5px 4px; border-radius: 12px; gap: 1px; }
.map-ind-ring { padding: 5px 8px; gap: 7px; }
.home-ring { width: 40px; height: 40px; }
.home-ring::before { inset: 4px; }
.home-ring b { font-size: 11px; }
.map-ind-row { display: inline-flex; align-items: center; gap: 5px; }
.map-ind-emoji { font-size: 15px; }
.map-ind-value { font-size: 15px; }
.map-ind-cap { font-size: 10.5px; }
.map-ind-text { font-size: 10.5px; }

/* Bosh sahifa: almashtirgich Telegram'ning o'z tugmalari (yopish/menyu)
   orasida, markazda turadi - shu sabab Telegram'ning "content" xavfsiz
   zonasi bu ekranda qaytarib olinadi (tizim status-bar zonasi qoladi).
   Boshqa ekranlarda chap tomonda logotip bor - ularda zona saqlanadi. */
.map-home { margin-top: calc(-1 * var(--tg-content-safe-area-inset-top, 0px)); }
.map-home .topbar-center { min-height: 36px; }

/* =====================================================================
   📐 Bosh sahifa ekranga SIG'ADI: xarita qolgan bo'sh joyni egallaydi
   (qat'iy 4:5 nisbat emas), tugunlar foizda joylashgani uchun ular
   xarita bilan birga cho'ziladi/qisqaradi. Yo'l chizig'i pikselda.
   ===================================================================== */
.map-home {
  display: flex; flex-direction: column;
  min-height: calc(var(--tg-viewport-stable-height, 100dvh) - 20px - var(--safe-top) - 78px - var(--safe-bottom));
}
.map-home .topbar-center { margin-bottom: 8px; min-height: 34px; }
.map-card { flex: 1; display: flex; flex-direction: column; min-height: 0; margin-bottom: 8px; padding: 8px; }
.home-map { aspect-ratio: auto; flex: 1; min-height: 205px; }
.map-path path { vector-effect: non-scaling-stroke; }
.map-path-grey { stroke-width: 2px; stroke-dasharray: 1 7; }
.map-path-gold { stroke-width: 3.5px; }

.chain-card { padding: 9px 12px; margin-bottom: 8px; border-radius: 18px; }
.chain-title { font-size: 16px; }
.chain-sub { font-size: 11.5px; margin: 0 0 7px; }
.chain-dot { width: 20px; height: 20px; }
.chain-link { margin-top: 9px; }
.chain-step { width: 52px; gap: 3px; }
.chain-step-label { font-size: 10.5px; }
.chain-chest { width: 58px; }

.round-actions { margin-bottom: 0; }
.round-btn { gap: 4px; }
.round-circle { width: 62px; height: 62px; border-width: 2.5px; }
.round-circle svg { width: 29px; height: 29px; }
.round-learn .round-circle { width: 70px; height: 70px; }
.round-learn .round-circle svg { width: 34px; height: 34px; }
.round-label { font-size: 12.5px; }
.round-badge { min-width: 20px; height: 20px; font-size: 11px; top: -3px; right: -3px; }

/* Xarita kichraygani uchun tugunlar ~2/3 hajmga */
.map-node-disc { width: 23px; height: 23px; border-width: 1.5px; }
.map-node-disc svg { width: 14px; height: 14px; }
.map-node-label { font-size: 9.5px; margin-top: 0; }
.map-node-sub { font-size: 8.5px; top: calc(100% + 11px); }
.map-node.is-current .map-node-disc { width: 31px; height: 31px; border-width: 2px; }
.map-node.is-current .map-node-disc svg { width: 16px; height: 16px; }
.map-node.is-current .map-node-label { font-size: 10.5px; }
.map-node.is-dome .map-node-disc { width: 36px; height: 36px; border-width: 1.5px; }
.map-node.is-dome .map-node-disc svg { width: 27px; height: 27px; }
.map-node.is-dome.is-current .map-node-disc { width: 42px; height: 42px; }
.map-node.is-dome.is-current .map-node-disc svg { width: 31px; height: 31px; }
.map-node.is-current .map-node-disc { box-shadow: 0 0 0 4px rgba(var(--gold-rgb), 0.18), 0 0 16px rgba(var(--gold-rgb), 0.85); }
.map-path-grey { stroke-width: 1.6px; stroke-dasharray: 1 6; }
.map-path-gold { stroke-width: 2.6px; }
.map-node::before { content: ""; position: absolute; inset: -8px -6px; }


/* =====================================================================
   🔗 Kunlik zanjir - haqiqiy holatlar va sandiq (2-bosqich)
   ===================================================================== */
.chain-link.is-done { background: var(--gold); }
.chain-dot svg { width: 14px; height: 14px; display: block; }
.chain-step.is-done .chain-dot { box-shadow: 0 0 8px rgba(var(--gold-rgb), 0.55); }
.chain-chest { background: none; border: none; padding: 0; cursor: pointer; opacity: 0.75; filter: grayscale(0.35) drop-shadow(0 0 6px rgba(var(--gold-rgb), 0.2)); }
.chain-chest.is-ready { opacity: 1; filter: drop-shadow(0 0 14px rgba(var(--gold-rgb), 0.95)); animation: chestPulse 1.4s ease-in-out infinite; }
.chain-chest.is-opened { opacity: 1; filter: drop-shadow(0 0 12px rgba(var(--gold-rgb), 0.8)); }
@keyframes chestPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.09) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .chain-chest.is-ready { animation: none; } }
.chest-glow { fill: rgba(var(--gold-rgb), 0.35); }
.chest-star { fill: var(--gold-soft); }
.chest-coin { fill: var(--gold-soft); stroke: var(--gold); stroke-width: 1; }

.chest-pop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 9, 22, 0.78);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.chest-pop-card {
  width: 100%; max-width: 320px; text-align: center;
  background: var(--ink-2); border: 1px solid var(--gold); border-radius: 22px;
  padding: 22px 20px; box-shadow: 0 0 40px rgba(var(--gold-rgb), 0.45);
}
.chest-pop-art { width: 130px; margin: 0 auto 6px; filter: drop-shadow(0 0 18px rgba(var(--gold-rgb), 0.9)); }
.chest-pop-title { font-family: 'Zilla Slab', serif; font-size: 20px; color: var(--text); }
.chest-pop-xp { font-size: 38px; font-weight: 800; color: var(--gold-soft); margin: 6px 0 16px; }

/* Sandiq rasmlari (GPT, tozalangan webp) */
.chain-chest { width: 66px; opacity: 1; filter: none; }
.chain-chest-img { width: 100%; height: auto; display: block; pointer-events: none; user-select: none; }
.chain-chest:not(.is-ready):not(.is-opened) .chain-chest-img { filter: brightness(0.62) saturate(0.55); }
.chain-chest.is-ready { filter: drop-shadow(0 0 12px rgba(var(--gold-rgb), 0.95)) drop-shadow(0 0 4px rgba(255, 220, 120, 0.9)); }
.chain-chest.is-opened { filter: drop-shadow(0 0 10px rgba(var(--gold-rgb), 0.7)); }
.chest-pop-art { width: 170px; }
.chest-pop-art .chain-chest-img { filter: drop-shadow(0 0 16px rgba(var(--gold-rgb), 0.85)); }


/* ---- Mavzu tabi ---- */
.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-bottom: 8px; }
.topic-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 12px; text-align: left; cursor: pointer;
  background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: 14px; color: inherit;
}
.topic-card.is-empty { opacity: .55; }
.topic-emoji { font-size: 26px; line-height: 1; }
.topic-emoji-lg { font-size: 44px; }
.topic-name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.topic-count { font-size: 12px; opacity: .7; }
.topic-bar { display: block; width: 100%; height: 4px; border-radius: 4px; background: var(--ink-3); overflow: hidden; margin-top: 2px; }
.topic-bar > span { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.topic-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin: 6px 0 16px; }
.topic-head .h1 { margin: 4px 0 0; }
.topic-head .topic-bar { max-width: 220px; margin-top: 8px; }
.topic-hint { text-align: center; margin-top: 8px; }
.topic-words { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; }
.topic-word-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--ink-3); }
.topic-word-ar { font-size: 20px; min-width: 90px; direction: rtl; text-align: right; }
.topic-word-tr { flex: 1; font-size: 14px; opacity: .85; }
.topic-word-row .audio-btn { width: 34px; height: 34px; margin: 0; padding: 0; flex: none; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.topic-word-ar { flex: none; width: 110px; line-height: 1.3; }
