/* ==========================================================================
   PatenTest Telegram Mini App & Admin Panel Design System
   ========================================================================== */

:root {
  --bg-color: var(--tg-theme-bg-color, #0f172a);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #1e293b);
  --text-color: var(--tg-theme-text-color, #f8fafc);
  --hint-color: var(--tg-theme-hint-color, #94a3b8);
  --link-color: var(--tg-theme-link-color, #38bdf8);
  --button-color: var(--tg-theme-button-color, #3b82f6);
  --button-text: var(--tg-theme-button-text-color, #ffffff);

  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --purple-gradient: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  --emerald-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --success-color: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --error-color: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.15);
  --card-bg: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

.user-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-color);
}

.user-status {
  font-size: 12px;
  color: var(--hint-color);
}

.icon-btn {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
}

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

/* App Nav */
.app-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--secondary-bg);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  overflow-x: auto;
}

.nav-tab {
  flex: 1;
  padding: 10px 6px;
  border: none;
  background: transparent;
  color: var(--hint-color);
  font-weight: 600;
  font-size: 11px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
}

.nav-tab.active {
  background: var(--button-color);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Multilingual Switcher Bar */
.lang-switcher-bar {
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
  overflow-x: auto;
}

.lang-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--hint-color);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.lang-btn.active {
  background: var(--button-color);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* Screen visibility */
.screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.screen.active {
  display: flex;
}

/* Hero card */
.hero-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(10px);
}

.hero-badge {
  display: inline-block;
  background: rgba(59, 130, 246, 0.2);
  color: var(--link-color);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.hero-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 13px;
  color: var(--hint-color);
  margin-bottom: 16px;
  line-height: 1.4;
}

.hero-stats {
  display: flex;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-val {
  font-weight: 800;
  font-size: 16px;
  color: var(--link-color);
}

.stat-lbl {
  font-size: 11px;
  color: var(--hint-color);
  margin-top: 2px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-top: 8px;
}

/* Categories grid */
.categories-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-card:active {
  transform: scale(0.98);
  border-color: var(--button-color);
}

.card-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-content {
  flex: 1;
}

.card-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.card-content p {
  font-size: 12px;
  color: var(--hint-color);
}

.card-arrow {
  color: var(--hint-color);
  font-size: 16px;
}

/* Lessons Study Center & Course Cards */
.lessons-subtabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.lesson-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-badge {
  font-size: 24px;
  width: 42px;
  height: 42px;
  background: rgba(139, 92, 246, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lesson-title {
  font-size: 16px;
  font-weight: 700;
}

.reading-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-color);
  position: relative;
}

/* Speech Audio Controls with Pause/Resume */
.speech-control-bar {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.speech-btn {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: var(--link-color);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

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

.speech-btn.playing {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.speech-btn.paused {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.speech-stop-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vocab-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 12px;
  border-radius: var(--radius-md);
}

.vocab-title {
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 4px;
}

.vocab-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-flip-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.word-flip-card:active {
  transform: scale(0.95);
  border-color: var(--button-color);
}

.word-flip-card .ru-word {
  font-weight: 700;
  font-size: 13px;
  color: var(--link-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.word-flip-card .trans-word {
  font-size: 11px;
  color: var(--hint-color);
}

.rule-box {
  background: rgba(15, 23, 42, 0.7);
  border-left: 4px solid #8b5cf6;
  padding: 12px 14px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 13px;
  line-height: 1.5;
}

.rule-box strong {
  color: var(--link-color);
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.example-chip {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--text-color);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
}

.example-chip.wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
  text-decoration: line-through;
}

.example-chip.right {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-weight: 600;
}

/* Test Runner */
.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-btn {
  background: transparent;
  border: none;
  color: var(--hint-color);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.timer {
  font-weight: 800;
  font-size: 15px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  padding: 4px 12px;
  border-radius: 20px;
}

.progress-bar-container {
  height: 6px;
  background: var(--secondary-bg);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.3s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--hint-color);
}

.cat-pill {
  background: var(--secondary-bg);
  padding: 3px 8px;
  border-radius: 8px;
  color: var(--link-color);
  font-weight: 600;
}

/* Question card */
.question-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.question-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 18px;
  word-break: break-word;
}

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

.option-btn {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
  display: flex;
  align-items: center;
}

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

.option-btn.correct {
  background: var(--success-bg);
  border-color: var(--success-color);
  color: #34d399;
  font-weight: 700;
}

.option-btn.incorrect {
  background: var(--error-bg);
  border-color: var(--error-color);
  color: #f87171;
}

/* Explanation Box */
.explanation-box {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 14px;
  border-radius: var(--radius-md);
}

.explanation-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--link-color);
  margin-bottom: 4px;
}

.explanation-text {
  font-size: 13px;
  color: var(--text-color);
  line-height: 1.4;
}

.action-footer {
  margin-top: auto;
  padding-top: 12px;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.btn-warning {
  background: var(--warning-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.btn-purple {
  background: var(--purple-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.btn-emerald {
  background: var(--emerald-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

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

/* Results Screen */
.result-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}

.result-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.result-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.result-subtitle {
  font-size: 13px;
  color: var(--hint-color);
  margin-bottom: 20px;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  border: 4px solid var(--button-color);
  margin: 0 auto 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-size: 28px;
  font-weight: 800;
  color: var(--link-color);
}

.score-label {
  font-size: 11px;
  color: var(--hint-color);
}

.stats-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  padding: 14px;
  border-radius: 14px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.text-success { color: var(--success-color); }
.text-danger { color: var(--error-color); }

/* Utilities & Modals */
.hidden { display: none !important; }

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
}

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

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

.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--hint-color);
}

.admin-input, .admin-select, .admin-textarea {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}

.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
  border-color: var(--button-color);
}

/* Toast notification */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid var(--button-color);
  color: var(--text-color);
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Admin Styles */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-admin {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.admin-subtabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.subtab {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  color: var(--hint-color);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.subtab.active {
  background: var(--button-color);
  color: #fff;
}

.subscreen {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.subscreen.active {
  display: flex;
}

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

.admin-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
}

.card-num {
  font-size: 20px;
  font-weight: 800;
}

.card-desc {
  font-size: 11px;
  color: var(--hint-color);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-table th, .admin-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  color: var(--hint-color);
}

.pill-success {
  background: var(--success-bg);
  color: var(--success-color);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.pill-danger {
  background: var(--error-bg);
  color: var(--error-color);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.tag-pill {
  background: rgba(59, 130, 246, 0.2);
  color: var(--link-color);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px;
}

.tag-remove {
  cursor: pointer;
  font-weight: 700;
}


/* Share Presentation Card & QR */
.share-presentation-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.share-bot-badge {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--link-color);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  width: 100%;
}

.qr-code-box {
  background: #ffffff;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.qr-img {
  width: 160px;
  height: 160px;
  display: block;
}

.qr-hint {
  font-size: 11px;
  color: #475569;
  font-weight: 600;
}

.share-text-box {
  width: 100%;
}



/* Rating Stars */
.rating-stars {
  display: flex;
  gap: 8px;
  font-size: 24px;
  cursor: pointer;
}
.rating-stars span {
  opacity: 0.4;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.rating-stars span.active, .rating-stars span:hover {
  opacity: 1;
  transform: scale(1.2);
}

/* Feedback Comment Card */
.feedback-comment-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}
.feedback-comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--link-color);
  margin-bottom: 4px;
}

/* Custom Themes Definitions */
body.theme-emerald {
  --bg-color: #064e3b;
  --secondary-bg: #047857;
  --button-color: #10b981;
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --card-bg: rgba(4, 120, 87, 0.7);
  --link-color: #6ee7b7;
}

body.theme-cyber {
  --bg-color: #0f051d;
  --secondary-bg: #1e0a38;
  --button-color: #ec4899;
  --accent-gradient: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  --card-bg: rgba(30, 10, 56, 0.75);
  --link-color: #f472b6;
}

body.theme-sunset {
  --bg-color: #451a03;
  --secondary-bg: #78350f;
  --button-color: #f97316;
  --accent-gradient: linear-gradient(135deg, #f97316 0%, #d97706 100%);
  --card-bg: rgba(120, 53, 15, 0.7);
  --link-color: #fbbf24;
}

body.theme-light {
  --bg-color: #f1f5f9;
  --secondary-bg: #ffffff;
  --text-color: #0f172a;
  --hint-color: #64748b;
  --button-color: #2563eb;
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --card-bg: rgba(255, 255, 255, 0.9);
  --border-color: rgba(0, 0, 0, 0.1);
  --link-color: #2563eb;
}



/* Mobile Game Grid & Podiums Responsiveness */
#wordMatchGameBoard {
  width: 100%;
  max-width: 100%;
}

#wordMatchGameBoard button {
  white-space: normal !important;
  word-break: break-word !important;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

.top-users-podium {
  width: 100%;
}



/* ═══════════════════════════════════════════════════════
   THEME SYSTEM — 5 Visual Themes
   ═══════════════════════════════════════════════════════ */

/* Default: Dark Cosmos (already applied via :root) */

/* Emerald Gloss */
body[data-theme="emerald"] {
  --bg-color: #022c22;
  --secondary-bg: #064e3b;
  --text-color: #d1fae5;
  --hint-color: #6ee7b7;
  --link-color: #34d399;
  --button-color: #059669;
  --card-bg: rgba(6, 78, 59, 0.7);
  --border-color: rgba(52, 211, 153, 0.2);
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  background: linear-gradient(180deg, #022c22 0%, #064e3b 40%, #022c22 100%) !important;
}

/* Cyberpunk Neon */
body[data-theme="cyber"] {
  --bg-color: #0d001a;
  --secondary-bg: #1e0a38;
  --text-color: #f0abfc;
  --hint-color: #c084fc;
  --link-color: #ec4899;
  --button-color: #a855f7;
  --card-bg: rgba(30, 10, 56, 0.8);
  --border-color: rgba(236, 72, 153, 0.25);
  --accent-gradient: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
  background: linear-gradient(180deg, #0d001a 0%, #1e0a38 40%, #0d001a 100%) !important;
}

/* Warm Sunset */
body[data-theme="sunset"] {
  --bg-color: #1c0a00;
  --secondary-bg: #451a03;
  --text-color: #fef3c7;
  --hint-color: #fbbf24;
  --link-color: #f59e0b;
  --button-color: #d97706;
  --card-bg: rgba(69, 26, 3, 0.7);
  --border-color: rgba(251, 191, 36, 0.2);
  --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  background: linear-gradient(180deg, #1c0a00 0%, #451a03 40%, #1c0a00 100%) !important;
}

/* Light Theme */
body[data-theme="light"] {
  --bg-color: #f8fafc;
  --secondary-bg: #e2e8f0;
  --text-color: #0f172a;
  --hint-color: #64748b;
  --link-color: #2563eb;
  --button-color: #3b82f6;
  --card-bg: rgba(226, 232, 240, 0.8);
  --border-color: rgba(148, 163, 184, 0.3);
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  background: #f8fafc !important;
}

body[data-theme="light"] .hero-card,
body[data-theme="light"] .admin-card {
  border-color: rgba(100, 116, 139, 0.2);
}

body[data-theme="light"] .category-card {
  border-color: rgba(100, 116, 139, 0.2) !important;
  background: rgba(226, 232, 240, 0.6) !important;
}

/* Active theme checkmark */
.theme-option-card .card-arrow {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.theme-option-card.active .card-arrow {
  opacity: 1;
  color: var(--success-color) !important;
  font-size: 18px;
  font-weight: bold;
}

/* ==========================================================================
   Gamification Screen — Activity Calendar, Achievements, Leagues, Duels
   ========================================================================== */

/* Activity Calendar */
.activity-calendar-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Streak summary */
.streak-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.streak-summary .streak-flame {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.4));
}

.streak-summary .streak-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.streak-summary .streak-count {
  font-size: 26px;
  font-weight: 800;
  color: #fbbf24;
  line-height: 1.1;
}

.streak-summary .streak-label {
  font-size: 12px;
  color: var(--hint-color);
}

.streak-summary .streak-reward {
  font-size: 14px;
  font-weight: 700;
  color: var(--success-color);
  background: var(--success-bg);
  border-radius: 10px;
  padding: 6px 10px;
  white-space: nowrap;
}

/* Calendar navigation */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--secondary-bg);
  color: var(--text-color);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.cal-nav-btn:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.08);
}

.cal-month-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-color);
}

/* Weekday labels */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.calendar-weekdays span {
  font-size: 11px;
  font-weight: 700;
  color: var(--hint-color);
  padding: 4px 0;
}

/* Day grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-grid .cal-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 0;
  font-size: 13px;
  color: var(--hint-color);
}

.cal-day {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color);
}

.cal-day-empty {
  background: transparent;
  border: none;
}

.cal-day.future {
  opacity: 0.4;
}

.cal-day.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(16, 185, 129, 0.12));
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.cal-day.today {
  border: 2px solid #fbbf24;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.25);
}

.cal-day.bonus {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(245, 158, 11, 0.12));
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.cal-day.today.active {
  border-color: #34d399;
}

.cal-day-num {
  line-height: 1;
}

.cal-day-check {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 10px;
  color: #34d399;
}

.cal-day-bonus {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 10px;
  color: #fbbf24;
}

/* Legend */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
  padding-top: 2px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--hint-color);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.legend-active {
  background: rgba(16, 185, 129, 0.7);
  border: 1px solid rgba(16, 185, 129, 0.9);
}

.legend-dot.legend-today {
  background: transparent;
  border: 2px solid #fbbf24;
}

.legend-dot.legend-bonus {
  background: rgba(245, 158, 11, 0.7);
  border: 1px solid rgba(245, 158, 11, 0.9);
}

/* Claim button / status (reuse .btn styles) */
#gamiClaimStreakBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Achievements */
.gami-achievement-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
}

.gami-achievement-card.unlocked {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.gami-achievement-card.locked {
  opacity: 0.5;
  filter: grayscale(0.6);
}

.gami-achievement-card .ach-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.gami-achievement-card .ach-name {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.gami-achievement-card .ach-reward {
  font-size: 11px;
  color: var(--success-color);
  font-weight: 600;
}

.gami-achievement-card .ach-status {
  font-size: 10px;
  color: var(--hint-color);
  margin-top: 4px;
}

.gami-achievement-card.unlocked .ach-status {
  color: var(--success-color);
}

/* Leagues */
.gami-league-current {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.gami-league-current .league-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.gami-league-current .league-name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.gami-league-current .league-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 12px;
}

.gami-league-current .league-stat {
  display: flex;
  flex-direction: column;
}

.gami-league-current .league-stat .val {
  font-size: 18px;
  font-weight: 800;
  color: var(--link-color);
}

.gami-league-current .league-stat .lbl {
  font-size: 11px;
  color: var(--hint-color);
}

.gami-leagues-progression {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.gami-leagues-progression .league-badge {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--secondary-bg);
  text-align: center;
  font-size: 11px;
}

.gami-leagues-progression .league-badge.current {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.gami-leagues-progression .league-badge .lb-icon {
  font-size: 20px;
}

.gami-leagues-progression .league-badge .lb-name {
  font-size: 10px;
  color: var(--hint-color);
  white-space: nowrap;
}

.gami-leagues-progression .league-badge.current .lb-name {
  color: var(--text-color);
  font-weight: 700;
}

.gami-leaderboard {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.gami-leaderboard table {
  width: 100%;
  border-collapse: collapse;
}

.gami-leaderboard th {
  background: rgba(15, 23, 42, 0.6);
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--hint-color);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.gami-leaderboard td {
  padding: 8px 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-color);
}

.gami-leaderboard tr.you {
  background: rgba(59, 130, 246, 0.1);
}

.gami-leaderboard tr.you td {
  font-weight: 700;
}

.gami-leaderboard .rank-medal {
  font-size: 14px;
}

/* Loading state */
.gami-loading {
  text-align: center;
  padding: 24px;
  color: var(--hint-color);
  font-size: 13px;
}

/* Empty state */
.gami-empty {
  text-align: center;
  padding: 24px;
  color: var(--hint-color);
  font-size: 13px;
}
