html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
  position: relative;
  -webkit-text-size-adjust: 100%;
  touch-action: pan-y;
}

.app-container, .main-wrapper, .content-body, .path-section, .unit-section-block, .unit-banner {
  max-width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   QAZAQ LINGO - DUOLINGO DESIGN SYSTEM (6-сынып)
   Таза, жеңіл, заманауи және ыңғайлы Duolingo интерфейсі
   ========================================================================== */

:root {
  --duo-green: #00afca;
  --duo-green-dark: #008b9e;
  --duo-green-light: #d4f6fc;
  --duo-blue: #1cb0f6;
  --duo-blue-dark: #1899d6;
  --duo-blue-light: #ddf4ff;
  --duo-orange: #10b981;
  --duo-orange-dark: #059669;
  --duo-orange-light: #d1fae5;
  --duo-red: #ff4b4b;
  --duo-red-dark: #ea2b2b;
  --duo-red-light: #ffdfe0;
  --duo-gold: #ffc800;
  --duo-gold-dark: #e6a800;
  --duo-purple: #a55eea;
  --duo-purple-dark: #8854d0;
  
  --duo-gray-bg: #ffffff;
  --duo-gray-panel: #f7f7f7;
  --duo-gray-border: #e5e5e5;
  --duo-gray-border-dark: #d5d5d5;
  --duo-gray-text: #777777;
  --duo-gray-dark: #4b4b4b;
  --duo-text-dark: #3c3c3c;
  
  --kazakh-cyan: #00afca;
  --kazakh-gold: #fec50c;
  
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --font-family: 'Nunito', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: #ffffff;
  color: var(--duo-text-dark);
  font-weight: 700;
  line-height: 1.45;
  overflow-x: clip;
  min-height: 100dvh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

input, button, select, textarea {
  font-family: var(--font-family);
  font-weight: 700;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  user-select: none;
}

/* ==========================================================================
   BUTTONS (Duolingo 3D Chunky Style)
   ========================================================================== */
.duo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  transition: filter 0.15s, transform 0.1s, box-shadow 0.1s;
  position: relative;
}

.duo-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 0 0 transparent !important;
}

.duo-btn-green {
  background-color: var(--duo-green);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--duo-green-dark);
}
.duo-btn-green:hover:not(:disabled) {
  filter: brightness(1.05);
}

.duo-btn-blue {
  background-color: var(--duo-blue);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--duo-blue-dark);
}
.duo-btn-blue:hover:not(:disabled) {
  filter: brightness(1.05);
}

.duo-btn-orange {
  background-color: var(--duo-orange);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--duo-orange-dark);
}

.duo-btn-purple {
  background-color: var(--duo-purple);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--duo-purple-dark);
}

.duo-btn-red {
  background-color: var(--duo-red);
  color: #ffffff;
  box-shadow: 0 4px 0 var(--duo-red-dark);
}

.duo-btn-white {
  background-color: #ffffff;
  color: var(--duo-blue);
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 4px 0 var(--duo-gray-border);
}
.duo-btn-white:hover {
  background-color: #f7f7f7;
}

.duo-btn-disabled, .duo-btn:disabled {
  background-color: #e5e5e5 !important;
  color: #afafaf !important;
  box-shadow: 0 4px 0 #d5d5d5 !important;
  cursor: not-allowed;
  transform: none !important;
}

/* ==========================================================================
   APP LAYOUT
   ========================================================================== */
.app-container {
  display: flex;
  min-height: 100dvh;
}

/* Left Sidebar */
.left-sidebar {
  width: 256px;
  border-right: 2px solid var(--duo-gray-border);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  background: #ffffff;
  z-index: 50;
  overflow-y: auto;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 14px;
  text-decoration: none;
  cursor: pointer;
}

.logo-mascot-mini {
  width: 40px;
  height: 40px;
}

.brand-text {
  font-size: 24px;
  font-weight: 900;
  color: #00afca;
  letter-spacing: -0.5px;
}
.brand-text span {
  color: #10b981;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  cursor: pointer;
  transition: background 0.15s;
  border: 2px solid transparent;
}

.nav-item:hover {
  background-color: #f7f7f7;
}

.nav-item.active {
  background-color: #ddf4ff;
  color: var(--duo-blue);
  border-color: #84d8ff;
}

.nav-item.highlight {
  color: var(--duo-purple-dark);
}
.nav-item.highlight.active {
  background-color: #f3e8ff;
  border-color: #d8b4fe;
  color: var(--duo-purple-dark);
}

.nav-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 2px solid var(--duo-gray-border);
}

.textbook-badge {
  background: #fff4e6;
  border: 2px solid #ffd8a8;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 12px;
  color: #d9480f;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.textbook-badge strong {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Main Content Area */
.main-wrapper {
  margin-left: 256px;
  flex: 1;
  min-width: 0;
  max-width: calc(100% - 256px);
  display: flex;
  flex-direction: column;
}

/* Top Sticky Header */
.top-header {
  height: 70px;
  border-bottom: 2px solid var(--duo-gray-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.course-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--duo-gray-border);
  background: #ffffff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.course-selector:hover {
  background: #f7f7f7;
}

.kz-flag {
  font-size: 20px;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.stat-item:hover {
  background: #f7f7f7;
}

.stat-fire { color: var(--duo-orange); }
.stat-gem { color: var(--duo-blue); }
.stat-heart { color: var(--duo-red); }

.sound-toggle-btn {
  background: none;
  font-size: 20px;
  padding: 8px;
  border-radius: var(--radius-full);
  border: 2px solid var(--duo-gray-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.sound-toggle-btn:hover {
  background: #f7f7f7;
}

/* Content Body */
.content-body {
  display: flex;
  justify-content: center;
  padding: 24px 28px 28px;
  gap: 48px;
}

/* ==========================================================================
   THE CONTINUOUS DUOLINGO PATHWAY (Вниз красивой змейкой)
   ========================================================================== */
.path-section {
  width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.unit-section-block {
  width: 100%;
  margin-bottom: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Duolingo Unit Header Card */
.unit-banner {
  width: 100%;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  color: #ffffff;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
}

.unit-banner::after {
  content: "⚡";
  position: absolute;
  right: -5px;
  bottom: -15px;
  font-size: 110px;
  opacity: 0.15;
  pointer-events: none;
}

.unit-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.unit-tag {
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 800;
}

.unit-guide-btn {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
  font-weight: 800;
}
.unit-guide-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.unit-title {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.unit-desc {
  font-size: 13px;
  opacity: 0.95;
  font-weight: 600;
  line-height: 1.45;
}

/* Snake Nodes Container */
.pathway-nodes-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  position: relative;
  width: 100%;
}

.path-node-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s;
  z-index: 5;
}

/* Fix: Активті плашка ашылғанда оның z-index мәні басқа түймелерден жоғары, бірақ сабақ экраны мен модальдерден төмен болуы тиіс */
.path-node-wrapper.popover-active {
  z-index: 30 !important;
}

/* Node Button */
.node-btn {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  border: 3px solid rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.15);
  z-index: 6;
}

.node-btn:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.node-btn.completed {
  background: var(--duo-gold) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 0 var(--duo-gold-dark) !important;
}

.node-btn.active-node {
  animation: pulse-ring 2s infinite;
  color: #ffffff;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 8px 0 var(--node-shadow, var(--duo-green-dark)), 0 0 0 0 var(--node-glow, rgba(0, 175, 202, 0.45)); }
  70% { box-shadow: 0 8px 0 var(--node-shadow, var(--duo-green-dark)), 0 0 0 16px rgba(0, 175, 202, 0); }
  100% { box-shadow: 0 8px 0 var(--node-shadow, var(--duo-green-dark)), 0 0 0 0 rgba(0, 175, 202, 0); }
}

.node-btn.locked {
  background: #e5e5e5 !important;
  color: #afafaf !important;
  box-shadow: 0 8px 0 #d5d5d5 !important;
  cursor: not-allowed;
}

.node-btn.boss-node {
  width: 84px;
  height: 84px;
  font-size: 34px;
  background: #ffc800 !important;
  box-shadow: 0 8px 0 #e6a800 !important;
}

.node-label {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-text-dark);
  background: #ffffff;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 2px 0 var(--duo-gray-border);
  white-space: nowrap;
}

/* Companion Mascot beside the active node */
.path-mascot-companion {
  position: absolute;
  left: -156px;
  top: -14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  cursor: pointer;
  animation: float-anim 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.85)) drop-shadow(0 4px 8px rgba(15, 23, 42, 0.14));
  z-index: 20;
}

@keyframes float-anim {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.mascot-speech-bubble {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 800;
  color: var(--duo-text-dark);
  box-shadow: 0 4px 0 var(--duo-gray-border);
  white-space: nowrap;
  margin-bottom: 6px;
  position: relative;
}

.mascot-speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 18px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-right: 2px solid var(--duo-gray-border);
  border-bottom: 2px solid var(--duo-gray-border);
  transform: rotate(45deg);
}

/* Duolingo Node Popover Card (Интерактивная плашка запуска - баг перекрытия исправлен) */
.node-popover-card {
  position: absolute;
  top: 104px;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 35 !important;
  animation: popover-bounce 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

.node-popover-card::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-left: 2px solid var(--duo-gray-border);
  border-top: 2px solid var(--duo-gray-border);
}

@keyframes popover-bounce {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-title {
  font-size: 16px;
  font-weight: 900;
  margin-bottom: 4px;
}
.popover-desc {
  font-size: 12px;
  color: var(--duo-gray-dark);
  font-weight: 600;
  margin-bottom: 12px;
}
.popover-reward {
  font-size: 12px;
  font-weight: 800;
  color: var(--duo-gold-dark);
  margin-bottom: 14px;
}

/* ==========================================================================
   RIGHT SIDEBAR (Легкий и чистый дизайн)
   ========================================================================== */
.right-sidebar {
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 88px;
  align-self: flex-start;
}

.sidebar-card {
  border: 2px solid var(--duo-gray-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: #ffffff;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-action {
  font-size: 13px;
  color: var(--duo-blue);
  text-transform: uppercase;
  cursor: pointer;
  font-weight: 800;
}
.card-action:hover {
  text-decoration: underline;
}

.textbook-card {
  background: linear-gradient(145deg, #fff9f0 0%, #fff 100%);
  border-color: #ffd8a8;
}

.textbook-preview {
  display: flex;
  gap: 16px;
  align-items: center;
}

.orange-book-cover {
  width: 68px;
  height: 92px;
  background: linear-gradient(135deg, #ff8c00 0%, #e65100 100%);
  border-radius: 8px 12px 12px 8px;
  box-shadow: 4px 4px 12px rgba(230, 81, 0, 0.25), inset 4px 0 0 rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  color: #fff;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}
.orange-book-cover:hover {
  transform: rotate(-3deg) scale(1.05);
}

.book-title-mini {
  font-size: 8px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}
.book-grade-badge {
  background: #ffffff;
  color: #e65100;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 4px;
  border-radius: 4px;
  align-self: flex-start;
}
.book-ornament {
  font-size: 16px;
  text-align: center;
}

.textbook-info h4 {
  font-size: 15px;
  margin-bottom: 4px;
  color: #d9480f;
}
.textbook-info p {
  font-size: 12px;
  color: var(--duo-gray-dark);
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}

.quest-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--duo-gray-border);
}
.quest-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.quest-icon {
  font-size: 22px;
  width: 36px;
  height: 36px;
  background: #f7f7f7;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.quest-details {
  flex: 1;
}
.quest-desc {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.quest-progress-bar {
  height: 10px;
  background: #e5e5e5;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.quest-progress-fill {
  height: 100%;
  background: var(--duo-gold);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* ==========================================================================
   СЕПТЕГІШ & СӨЗГЕ ТОЛЫҚ ТАЛДАУ (Код из сайта пользователя)
   ========================================================================== */
.declension-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.declension-search-box {
  display: flex;
  gap: 12px;
  align-items: center;
}

.declension-input {
  flex: 1;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 4px 0 var(--duo-gray-border);
  font-size: 16px;
  font-weight: 700;
  color: var(--duo-text-dark);
  outline: none;
  transition: border-color 0.2s;
}
.declension-input:focus {
  border-color: var(--duo-blue);
  box-shadow: 0 4px 0 var(--duo-blue);
}

.mode-toggle-group {
  display: flex;
  border: 2px solid var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 4px;
  background: #f7f7f7;
  gap: 4px;
}
.mode-toggle-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  background: none;
  color: var(--duo-gray-dark);
}
.mode-toggle-btn.active {
  background: #ffffff;
  color: var(--duo-blue);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.preset-chips-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.preset-chip {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 2px 0 var(--duo-gray-border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--duo-text-dark);
  cursor: pointer;
  transition: all 0.1s;
}
.preset-chip:hover {
  background: #f7f7f7;
  border-color: var(--duo-blue);
}
.preset-chip.active {
  background: #ddf4ff;
  border-color: #84d8ff;
  color: var(--duo-blue-dark);
}

.word-analysis-output {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.word-card-full {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  background: #ffffff;
}

.info {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 4px 0 var(--duo-gray-border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
}
.info h3 {
  font-size: 16px;
  font-weight: 900;
  color: var(--duo-text-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.info p {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--duo-gray-dark);
  line-height: 1.5;
}
.info p b {
  color: var(--duo-text-dark);
}
.info p:last-child {
  margin-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 800;
  margin-right: 6px;
  margin-bottom: 6px;
}
.badge-plural { background: #e7f5ff; color: #1971c2; border: 1px solid #a5d8ff; }
.badge-poss { background: #f3f0ff; color: #7950f2; border: 1px solid #d0bfff; }
.badge-case { background: #fff4e6; color: #d9480f; border: 1px solid #ffd8a8; }
.badge-default { background: #ebfbee; color: #2b8a3e; border: 1px solid #b2f2bb; }

.word-build {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.morph-part {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
}
.morph-root { background: #e6fcf5; border: 2px solid #63e6be; color: #0ca678; }
.morph-plur { background: #e7f5ff; border: 2px solid #74c0fc; color: #1c7ed6; }
.morph-poss { background: #f3f0ff; border: 2px solid #b197fc; color: #7048e8; }
.morph-case { background: #fff4e6; border: 2px solid #ffa94d; color: #f76707; }
.morph-plus { font-size: 18px; font-weight: 900; color: var(--duo-gray-text); }

.sound-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.sound-box {
  background: #f8f9fa;
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 3px 0 var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  color: var(--duo-blue-dark);
}
.sound-box b {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--duo-gray-text);
  letter-spacing: 0.5px;
}

.letters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.letter-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 3px 0 var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.letter-char {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}
.letter-type {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.letter-desc {
  font-size: 11px;
  color: var(--duo-gray-dark);
  font-weight: 700;
  line-height: 1.3;
}

.cases-card-table {
  border: 2px solid var(--duo-gray-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 6px 0 var(--duo-gray-border);
}
.cases-header-row {
  display: grid;
  grid-template-columns: 2.2fr 1.6fr 1.8fr 2.4fr 48px;
  padding: 12px 20px;
  background: #f7f7f7;
  border-bottom: 2px solid var(--duo-gray-border);
  font-size: 12px;
  font-weight: 800;
  color: var(--duo-gray-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.case-row-item {
  display: grid;
  grid-template-columns: 2.2fr 1.6fr 1.8fr 2.4fr 48px;
  padding: 12px 20px;
  align-items: center;
  border-bottom: 1px solid var(--duo-gray-border);
  font-size: 14px;
  transition: background 0.15s;
}
.case-row-item:last-child {
  border-bottom: none;
}
.case-row-item:hover {
  background: #fafafa;
}
.case-name-cell h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--duo-text-dark);
}
.case-name-cell span {
  font-size: 12px;
  color: var(--duo-gray-text);
}
.case-quest-cell {
  font-size: 13px;
  font-weight: 700;
  color: var(--duo-blue-dark);
}
.case-result-cell {
  font-size: 15px;
  font-weight: 900;
  color: var(--duo-green-dark);
}
.case-example-cell {
  font-size: 13px;
  color: var(--duo-gray-dark);
}

.trainer-box {
  background: linear-gradient(145deg, #f3f0ff 0%, #ffffff 100%);
  border: 2px solid #d8b4fe;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 6px 0 #c084fc;
  margin-top: 16px;
}
.trainer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 900;
  color: var(--duo-purple-dark);
  margin-bottom: 12px;
}

/* ==========================================================================
   INTERACTIVE LESSON VIEW
   ========================================================================== */
.lesson-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 100;
  display: flex;
  flex-direction: column;
  display: none;
}
.lesson-screen.active {
  display: flex;
}
.lesson-header {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  gap: 32px;
}
.lesson-close-btn {
  background: none;
  border: none;
  font-size: 26px;
  color: #afafaf;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
}
.lesson-close-btn:hover {
  color: var(--duo-gray-dark);
}
.lesson-progress-container {
  flex: 1;
  height: 16px;
  background: #e5e5e5;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.lesson-progress-fill {
  height: 100%;
  background: var(--duo-green);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.lesson-progress-fill::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 8px;
  right: 8px;
  height: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-full);
}
.lesson-hearts {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--duo-red);
}

.lesson-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 24px 120px;
  overflow-y: auto;
}
.lesson-question-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--duo-text-dark);
  align-self: flex-start;
  margin-bottom: 24px;
}

.dialogue-prompt-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
  width: 100%;
}
.dialogue-mascot {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.prompt-speech-bubble {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 19px;
  color: var(--duo-text-dark);
  position: relative;
  box-shadow: 0 4px 0 var(--duo-gray-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.prompt-speech-bubble::before {
  content: "";
  position: absolute;
  top: 24px;
  left: -8px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-left: 2px solid var(--duo-gray-border);
  border-bottom: 2px solid var(--duo-gray-border);
  transform: rotate(45deg);
}

.audio-btn {
  background: var(--duo-blue);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 3px 0 var(--duo-blue-dark);
  flex-shrink: 0;
  transition: transform 0.1s;
}
.audio-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

.word-answer-slots {
  width: 100%;
  min-height: 64px;
  border-top: 2px solid var(--duo-gray-border);
  border-bottom: 2px solid var(--duo-gray-border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  margin-bottom: 36px;
}
.word-bank-chips {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.word-chip {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 4px 0 var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--duo-text-dark);
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
}
.word-chip:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--duo-gray-border);
}
.word-chip.used {
  background: #e5e5e5;
  color: transparent;
  border-color: #e5e5e5;
  box-shadow: 0 4px 0 #d5d5d5;
  cursor: default;
  pointer-events: none;
}

.choice-options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.choice-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 4px 0 var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  color: var(--duo-text-dark);
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.1s;
}
.choice-card:hover {
  background: #f7f7f7;
}
.choice-card.selected {
  border-color: #84d8ff;
  background: #ddf4ff;
  color: var(--duo-blue-dark);
  box-shadow: 0 4px 0 #84d8ff;
}
.choice-index-key {
  width: 28px;
  height: 28px;
  border: 2px solid var(--duo-gray-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--duo-gray-text);
  font-weight: 800;
}
.choice-card.selected .choice-index-key {
  border-color: var(--duo-blue);
  color: var(--duo-blue);
}

.pair-grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}
.pair-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pair-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 4px 0 var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.pair-card:hover {
  background: #f7f7f7;
}
.pair-card.selected {
  border-color: #84d8ff;
  background: #ddf4ff;
  color: var(--duo-blue);
  box-shadow: 0 4px 0 #84d8ff;
}
.pair-card.matched {
  background: #e5e5e5;
  color: #afafaf;
  border-color: #d5d5d5;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
  transform: scale(0.98);
}
.pair-card.error {
  border-color: var(--duo-red);
  background: var(--duo-red-light);
  color: var(--duo-red);
  animation: shake 0.3s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.fill-blank-sentence {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 32px;
  text-align: center;
  line-height: 1.8;
}
.blank-slot {
  display: inline-block;
  min-width: 120px;
  border-bottom: 3px solid var(--duo-blue);
  color: var(--duo-blue);
  padding: 0 10px;
  text-align: center;
}

.lesson-footer-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 2px solid var(--duo-gray-border);
  background: #ffffff;
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 110;
  transition: background-color 0.25s, border-color 0.25s;
}
.feedback-left {
  display: flex;
  align-items: center;
  gap: 18px;
}
.feedback-icon-circle {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.feedback-message-box h3 {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 4px;
}
.feedback-message-box p {
  font-size: 14px;
  font-weight: 600;
}
.lesson-footer-drawer.correct {
  background-color: var(--duo-green-light);
  border-color: var(--duo-green-light);
}
.lesson-footer-drawer.correct .feedback-icon-circle { background: #ffffff; color: var(--duo-green); }
.lesson-footer-drawer.correct .feedback-message-box h3,
.lesson-footer-drawer.correct .feedback-message-box p { color: var(--duo-green-dark); }
.lesson-footer-drawer.wrong {
  background-color: var(--duo-red-light);
  border-color: var(--duo-red-light);
}
.lesson-footer-drawer.wrong .feedback-icon-circle { background: #ffffff; color: var(--duo-red); }
.lesson-footer-drawer.wrong .feedback-message-box h3,
.lesson-footer-drawer.wrong .feedback-message-box p { color: var(--duo-red-dark); }

.complete-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  display: none;
}
.complete-screen.active {
  display: flex;
}
.complete-mascot {
  width: 140px;
  height: 140px;
  margin-bottom: 24px;
  animation: bounce 0.6s infinite alternate;
}
@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-16px); }
}
.complete-title {
  font-size: 30px;
  font-weight: 900;
  color: var(--duo-gold-dark);
  margin-bottom: 8px;
}
.complete-subtitle {
  font-size: 16px;
  color: var(--duo-gray-dark);
  margin-bottom: 32px;
}
.complete-stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
  width: 100%;
  max-width: 500px;
}
.stat-card-box {
  flex: 1;
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.08);
}
.stat-card-box.xp { background: #fff4e6; border: 2px solid #ffd8a8; color: var(--duo-orange-dark); }
.stat-card-box.accuracy { background: #e6fcf5; border: 2px solid #96f2d7; color: #0ca678; }
.stat-card-box.streak { background: #fff0f6; border: 2px solid #fcc2d7; color: #d6336c; }
.stat-card-val { font-size: 24px; font-weight: 900; }
.stat-card-lbl { font-size: 12px; text-transform: uppercase; font-weight: 800; letter-spacing: 0.5px; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 24px;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-window {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.active .modal-window { transform: translateY(0); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 2px solid var(--duo-gray-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fdfdfd;
}
.modal-title { font-size: 20px; font-weight: 900; display: flex; align-items: center; gap: 10px; }
.modal-close-btn { background: none; font-size: 24px; color: #afafaf; }
.modal-close-btn:hover { color: var(--duo-gray-dark); }
.modal-content-scroll { padding: 24px; overflow-y: auto; flex: 1; }

.tb-nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--duo-gray-border);
  margin-bottom: 20px;
}
.tb-tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.tb-tab-btn.active { color: var(--duo-orange); border-bottom-color: var(--duo-orange); }

.tb-vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.tb-vocab-card {
  border: 2px solid var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.tb-vocab-info h4 { font-size: 16px; font-weight: 800; color: var(--duo-text-dark); margin-bottom: 4px; }
.tb-vocab-info p { font-size: 13px; color: var(--duo-gray-dark); font-weight: 600; }
.tb-vocab-info .example { font-size: 12px; color: var(--duo-gray-text); font-style: italic; margin-top: 6px; }

.grammar-block {
  margin-bottom: 24px;
  border: 2px solid var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 18px;
}
.grammar-block h4 { font-size: 17px; font-weight: 800; margin-bottom: 8px; color: var(--duo-blue); }
.grammar-rule { font-size: 14px; margin-bottom: 12px; line-height: 1.5; }
.grammar-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 13px; }
.grammar-table th, .grammar-table td { border: 1px solid var(--duo-gray-border); padding: 8px 12px; text-align: left; }
.grammar-table th { background: #f7f7f7; font-weight: 800; }

.view-container {
  display: none;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 24px;
}
.view-container.active { display: block; }

/* ==========================================================================
   AUTHENTIC DUOLINGO LEADERBOARD / LEAGUE SYSTEM
   ========================================================================== */
.leaderboard-header-banner {
  flex-wrap: wrap;
  background: linear-gradient(135deg, #1cb0f6 0%, #0092d6 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 119, 176, 0.22);
  position: relative;
  overflow: hidden;
}
.leaderboard-header-banner::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 140px;
  height: 140px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  pointer-events: none;
}
.league-trophy-icon {
  font-size: 54px;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
  animation: bounceMini 2s infinite ease-in-out;
}
@keyframes bounceMini {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.league-info-text {
  flex: 1;
  min-width: 210px;
  text-align: left;
}
.league-badge-top {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
  background: rgba(255, 255, 255, 0.25);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.league-title-main {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 4px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.league-subtitle {
  font-size: 13px;
  opacity: 0.95;
  font-weight: 600;
  line-height: 1.4;
}
.league-timer-box {
  background: rgba(255, 255, 255, 0.95);
  color: #0369a1;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  padding: 10px 16px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 900;
  white-space: nowrap;
  flex-shrink: 0;
}

.league-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.leaderboard-row {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  border: 2px solid var(--duo-gray-border);
  border-radius: var(--radius-md);
  background: #ffffff;
  gap: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.leaderboard-row:hover {
  transform: translateY(-2px);
  border-color: var(--duo-blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.leaderboard-row.user-row {
  border-color: #84d8ff;
  background: #eef9ff;
  box-shadow: 0 4px 0 #b3e7ff;
}
.leaderboard-row.user-row.active-user-glow {
  border-color: var(--duo-blue);
}
.leaderboard-row.registered-account-row {
  background: #fbfdff;
}

.rank-num {
  font-size: 18px;
  font-weight: 900;
  width: 34px;
  text-align: center;
  color: var(--duo-gray-dark);
}
.rank-num.rank-gold { font-size: 24px; }
.rank-num.rank-silver { font-size: 24px; }
.rank-num.rank-bronze { font-size: 24px; }

.user-avatar {
  font-size: 28px;
  line-height: 1;
}
.user-info-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.user-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.user-name {
  font-size: 16px;
  font-weight: 900;
  color: var(--duo-text-dark);
}
.user-sub-meta {
  font-size: 12px;
  font-weight: 700;
  color: var(--duo-gray-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.league-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}
.league-pill-me {
  background: var(--duo-green);
  color: #ffffff;
}
.league-pill-registered {
  background: #e1f3fe;
  color: var(--duo-blue-dark);
  border: 1px solid #b8e2fb;
}
.league-pill-class {
  background: #f0f0f0;
  color: var(--duo-gray-dark);
}

.user-xp-box {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.user-xp-box .xp-val {
  font-size: 18px;
  font-weight: 900;
  color: var(--duo-text-dark);
}
.user-xp-box .xp-lbl {
  font-size: 12px;
  font-weight: 800;
  color: var(--duo-yellow);
}

.league-zone-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.6px;
  margin: 4px 0;
}
.league-zone-divider.promotion-zone {
  background: #f0fbf0;
  color: var(--duo-green-dark);
  border: 1px dashed var(--duo-green);
}
.league-zone-divider.demotion-zone {
  background: #fff0f0;
  color: var(--duo-red-dark);
  border: 1px dashed var(--duo-red);
}

.shop-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.shop-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 2px solid var(--duo-gray-border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.shop-card-left { display: flex; align-items: center; gap: 16px; }
.shop-card-icon { font-size: 36px; }
.shop-card-info h4 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.shop-card-info p { font-size: 13px; color: var(--duo-gray-dark); font-weight: 600; }

/* ==========================================================================
   AUTHENTICATION & MULTI-USER SYSTEM (Duolingo Style)
   ========================================================================== */
.auth-container {
  padding: 4px 6px 16px;
}

.auth-title-box {
  text-align: center;
  margin-bottom: 20px;
}
.auth-title-box h3 {
  font-size: 22px;
  font-weight: 900;
  color: var(--duo-text-dark);
  margin-bottom: 6px;
}
.auth-title-box p {
  font-size: 14px;
  color: var(--duo-gray-dark);
  line-height: 1.45;
}

.auth-form-group {
  margin-bottom: 16px;
  text-align: left;
}
.auth-label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--duo-gray-text);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-wrap .auth-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  pointer-events: none;
  opacity: 0.7;
}
.auth-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 700;
  color: var(--duo-text-dark);
  background: #f7f7f7;
  border: 2px solid var(--duo-gray-border);
  border-radius: 14px;
  outline: none;
  transition: all 0.2s;
}
.auth-input:focus {
  background: #ffffff;
  border-color: var(--duo-blue);
  box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.2);
}
.auth-toggle-pass {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  color: var(--duo-gray-dark);
  transition: transform 0.15s;
}
.auth-toggle-pass:hover {
  transform: scale(1.15);
}

/* Avatar Selector Grid */
.auth-avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 6px;
}
.auth-avatar-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}
.auth-avatar-chip span.emoji {
  font-size: 26px;
  margin-bottom: 2px;
}
.auth-avatar-chip span.name {
  font-size: 10px;
  font-weight: 800;
  color: var(--duo-gray-dark);
}
.auth-avatar-chip:hover {
  background: #f4faff;
  border-color: var(--duo-blue);
  transform: translateY(-2px);
}
.auth-avatar-chip.selected {
  background: #eef8ff;
  border-color: var(--duo-blue);
  box-shadow: 0 3px 0 var(--duo-blue-dark);
}

/* Bonus Box */
.auth-bonus-box {
  background: linear-gradient(135deg, #fff7d6 0%, #fff0b3 100%);
  border: 2px solid #fedb41;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #8f6500;
  box-shadow: 0 2px 0 #eed030;
}

/* Alerts */
.auth-alert {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s;
}
.auth-alert-error {
  background: #ffebeb;
  border: 2px solid var(--duo-red);
  color: var(--duo-red-dark);
}
.auth-alert-success {
  background: #ebfaeb;
  border: 2px solid var(--duo-green);
  color: var(--duo-green-dark);
}

/* Saved Accounts List */
.auth-saved-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 2px solid var(--duo-gray-border);
}
.auth-saved-title {
  font-size: 11px;
  font-weight: 900;
  color: var(--duo-gray-text);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-align: left;
}
.auth-account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f7f7f7;
  border: 2px solid var(--duo-gray-border);
  border-radius: 14px;
  margin-bottom: 8px;
  transition: all 0.15s;
}
.auth-account-card:hover {
  border-color: var(--duo-blue);
  background: #ffffff;
}
.auth-account-card.active-card {
  border-color: var(--duo-green);
  background: #f0fbf0;
}
.auth-acc-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  flex: 1;
}
.auth-acc-avatar {
  font-size: 28px;
}
.auth-acc-meta {
  text-align: left;
}
.auth-acc-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--duo-text-dark);
}
.auth-acc-stats {
  font-size: 12px;
  font-weight: 700;
  color: var(--duo-gray-dark);
}
.auth-acc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-delete-btn {
  background: none;
  border: none;
  color: var(--duo-gray-text);
  font-size: 15px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.15s;
}
.auth-delete-btn:hover {
  color: var(--duo-red);
  background: #ffebee;
}

/* Profile Tab View */
.profile-hero {
  text-align: center;
  padding: 6px 0 16px;
}
.profile-avatar-large {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.08));
}
.profile-username {
  font-size: 24px;
  font-weight: 900;
  color: var(--duo-text-dark);
  margin-bottom: 2px;
}
.profile-sub {
  font-size: 13px;
  font-weight: 700;
  color: var(--duo-gray-dark);
  margin-bottom: 14px;
}
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.profile-stat-box {
  background: #f7f7f7;
  border: 2px solid var(--duo-gray-border);
  border-radius: 14px;
  padding: 12px;
  text-align: left;
}
.profile-stat-box .lbl {
  font-size: 11px;
  font-weight: 900;
  color: var(--duo-gray-text);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.profile-stat-box .val {
  font-size: 18px;
  font-weight: 900;
  color: var(--duo-text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
}

@media (max-width: 1120px) {
  .right-sidebar { display: none; }
  .top-header { padding: 0 16px; }
  .header-stats { gap: 8px; flex-wrap: nowrap; }
  .course-selector { padding: 6px 10px; font-size: 13px; }
  .cases-header-row, .case-row-item { grid-template-columns: 2fr 1.5fr 1.5fr 40px; }
  .case-example-cell { display: none; }
  .word-card-full { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Mobile Viewport & Full Width Optimization (При открытии на телефоне всё видно сразу) */
  html, body {
    overflow-x: clip !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  .top-header {
    height: 54px !important;
    padding: 0 8px !important;
    gap: 6px !important;
    overflow: hidden !important;
  }
  .header-left {
    min-width: 0 !important;
    flex-shrink: 1 !important;
  }
  .course-selector {
    padding: 4px 6px !important;
    font-size: 12px !important;
    gap: 4px !important;
  }
  .course-selector span:nth-child(2) {
    max-width: 70px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 12px !important;
  }
  .header-stats {
    gap: 4px !important;
    flex-shrink: 0 !important;
  }
  .stat-item {
    padding: 3px 6px !important;
    font-size: 11px !important;
    gap: 3px !important;
    border-radius: 999px !important;
  }
  .stat-item span:first-child {
    font-size: 13px !important;
  }
  .sound-toggle-btn {
    width: 30px !important;
    height: 30px !important;
    font-size: 13px !important;
    padding: 0 !important;
  }
  #header-user-btn {
    padding: 3px 6px !important;
    gap: 4px !important;
    font-size: 11px !important;
  }
  #header-user-btn span:last-child {
    max-width: 50px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 11px !important;
  }
  .content-body {
    padding: 12px 12px 76px !important;
    gap: 0 !important;
  }
  .path-section {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .node-popover-card {
    width: min(280px, calc(100vw - 32px)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }
  .unit-banner {
    padding: 16px 16px !important;
    margin-bottom: 24px !important;
  }
  .unit-title {
    font-size: 17px !important;
    line-height: 1.3 !important;
  }
  .unit-desc {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }
  .modal-window {
    width: calc(100% - 24px) !important;
    max-width: 440px !important;
    margin: 10px auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .left-sidebar {
    width: 100%;
    height: 64px;
    top: auto;
    bottom: 0;
    flex-direction: row;
    padding: 0;
    border-right: none !important;
    border-top: 2px solid var(--duo-gray-border) !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: #ffffff;
    z-index: 90;
  }
  .left-sidebar::-webkit-scrollbar { display: none; }
  .brand-logo, .sidebar-footer { display: none; }
  .nav-links {
    flex-direction: row;
    width: auto;
    min-width: 100%;
    justify-content: flex-start;
    gap: 4px;
    padding: 0 8px;
    margin: 0;
  }
  .nav-item {
    flex-direction: column;
    flex-shrink: 0;
    min-width: 68px;
    padding: 6px 8px;
    font-size: 10px;
    gap: 3px;
    white-space: nowrap;
    text-align: center;
  }
  .nav-item span:not(.nav-icon) { font-size: 10px; }
  .main-wrapper { margin-left: 0; max-width: 100%; margin-bottom: 0; }
  .top-header { padding: 0 16px; }
  .content-body { padding: 16px; }
  .path-section { width: 100%; }
  .path-mascot-companion {
    display: flex;
    left: -82px;
    top: -10px;
    transform: scale(0.76);
    transform-origin: center right;
  }
  .lesson-footer-drawer { flex-direction: column; gap: 16px; padding: 16px; text-align: center; }
  .feedback-left { flex-direction: column; }
  .duo-btn:not(.shop-card .duo-btn):not(.btn-group .duo-btn):not(.duo-btn-sm):not(.clan-card .duo-btn):not(.league-actions-wrap .duo-btn) { width: 100%; }
  .declension-search-box { flex-direction: column; }
  .sound-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-avatar-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .tb-nav-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tb-nav-tabs::-webkit-scrollbar { display: none; }
}

/* ==========================================================================
   GLOBAL DUOLINGO FLOATING TOAST NOTIFICATION
   ========================================================================== */
.qazaq-toast-banner {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--duo-green);
  color: white;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  z-index: 999999;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid white;
}
.qazaq-toast-banner.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.qazaq-toast-banner.error {
  background: var(--duo-red);
}

.auth-account-card {
  cursor: pointer;
}
.auth-account-card:hover {
  background: #f0f7ff !important;
  border-color: var(--duo-blue) !important;
  transform: translateY(-1px);
}
.auth-account-card.active-card {
  background: #f2fbf0 !important;
  border-color: var(--duo-green) !important;
}

/* ==========================================================================
   LEAGUE HEADER & META ROW ENHANCEMENTS
   ========================================================================== */
.league-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.league-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  background: #f7f7f7;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--duo-gray-border);
}

.league-meta-dot {
  color: var(--duo-gray-border);
}

.league-actions-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 768px) {
  .leaderboard-header-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 16px;
  }
  .leaderboard-header-banner::after {
    display: none;
  }
  .league-trophy-icon {
    font-size: 40px;
  }
  .league-title-main {
    font-size: 20px;
  }
  .league-subtitle {
    font-size: 13px;
  }
  .league-timer-box {
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
    font-size: 12px;
    box-sizing: border-box;
  }
  .league-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .league-meta-pill {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
  .league-actions-wrap {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .league-actions-wrap .duo-btn {
    flex: 1;
  }
  .leaderboard-row {
    padding: 10px 12px;
    gap: 10px;
  }
  .rank-num {
    font-size: 15px;
    width: 26px;
  }
  .user-avatar {
    font-size: 26px;
    width: 40px;
    height: 40px;
  }
  .user-name {
    font-size: 14px;
  }
  .user-sub-meta {
    font-size: 11px;
    gap: 4px;
  }
  .user-xp-box .xp-val {
    font-size: 16px;
  }
  .user-xp-box .xp-lbl {
    font-size: 10px;
  }
}

/* ====================================================================
   QAZAQSTAN NATIONAL AVATAR BADGE SYSTEM
   ==================================================================== */
.user-avatar {
  font-size: 24px;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
  border: 2px solid #00bcd4;
  box-shadow: 0 3px 0 #0097a7;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.leaderboard-row:hover .user-avatar {
  transform: scale(1.1) rotate(4deg);
}

.auth-acc-avatar {
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
  border: 2px solid #00bcd4;
  box-shadow: 0 3px 0 #0097a7;
  flex-shrink: 0;
}

.profile-avatar-large {
  font-size: 58px;
  line-height: 1;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 50%, #80deea 100%);
  border: 4px solid #00bcd4;
  box-shadow: 0 5px 0 #0097a7, 0 8px 16px rgba(0, 188, 212, 0.25);
}

.profile-mini-avatar-chip {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #f0f7f9;
  border: 2px solid #b2ebf2;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 2px;
  box-sizing: border-box;
}
.profile-mini-avatar-chip:hover {
  transform: scale(1.18);
  border-color: #00bcd4;
}
.profile-mini-avatar-chip.selected {
  background: #e0f7fa;
  border-color: #00bcd4;
  box-shadow: 0 0 0 2px #ffc107;
  transform: scale(1.15);
}

.auth-avatar-chip {
  padding: 8px 4px;
  border: 2px solid #b2ebf2;
  background: #fbfdfe;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.auth-avatar-chip .avatar-icon-wrap {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.auth-avatar-chip .avatar-icon-wrap img {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.auth-avatar-chip span.name {
  font-size: 10px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  text-align: center;
  line-height: 1.2;
}
.auth-avatar-chip.selected {
  background: #e0f7fa;
  border-color: #00bcd4;
  box-shadow: 0 3px 0 #0097a7;
}

.auth-acc-avatar {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
}
.kz-avatar-img {
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.auth-avatar-chip:hover .kz-avatar-img,
.profile-mini-avatar-chip:hover .kz-avatar-img {
  transform: scale(1.08);
}

/* ==========================================================================
   DUOLINGO FULLSCREEN WELCOME & ONBOARDING SCREEN
   ========================================================================== */
.auth-welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #ffffff;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-welcome-screen.active {
  display: flex;
}

.welcome-pane {
  display: none;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.welcome-pane.active {
  display: flex;
}

.welcome-content-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
}

.welcome-mascot-wrap {
  width: 150px;
  height: 150px;
  margin-bottom: 12px;
  animation: duoFloat 3s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-mascot-mini-wrap {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes duoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.welcome-title {
  font-size: 38px;
  font-weight: 900;
  color: #00afca;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}

.welcome-title span {
  color: var(--duo-orange);
}

.welcome-subtitle {
  font-size: 16px;
  font-weight: 700;
  color: #777777;
  line-height: 1.45;
  margin: 0 0 16px;
  max-width: 320px;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eef8ff;
  color: #1899d6;
  border: 2px solid #bce6ff;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 36px;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.welcome-main-btn {
  padding: 15px 24px;
  font-size: 15px;
  letter-spacing: 0.6px;
  width: 100%;
}

.welcome-header-bar {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 18px;
  border-bottom: 2px solid #e5e5e5;
  margin-bottom: 20px;
}

.welcome-back-btn {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 900;
  color: #afafaf;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 10px;
  transition: all 0.15s;
}

.welcome-back-btn:hover {
  color: #4b4b4b;
  background: #f0f0f0;
}

.welcome-bar-title {
  font-size: 18px;
  font-weight: 900;
  color: #4b4b4b;
}

.welcome-form-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.welcome-saved-box {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 2px solid #e5e5e5;
  width: 100%;
}


/* ==========================================================================
   MISSING INTERACTIVE CLASSES & COMPONENT POLISH
   ========================================================================== */
.open-textbook-btn {
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.open-textbook-btn:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}

.unit-switcher-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0;
  margin-bottom: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.unit-switcher-nav::-webkit-scrollbar {
  display: none;
}

.unit-tab-pill {
  border: 2px solid var(--duo-gray-border);
  background: #ffffff;
  color: var(--duo-gray-dark);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--duo-gray-border);
  transition: all 0.15s ease;
  user-select: none;
}
.unit-tab-pill:hover {
  background: #f7f9fa;
  border-color: #d1d5db;
}
.unit-tab-pill.active {
  background: var(--duo-blue);
  color: #ffffff;
  border-color: var(--duo-blue-dark);
  box-shadow: 0 3px 0 var(--duo-blue-dark);
}

.declension-cat-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.timer-icon {
  font-size: 16px;
}
.timer-text {
  font-weight: 800;
  font-size: 13px;
  color: var(--duo-gray-dark);
}

.duo-btn-sm {
  padding: 6px 14px !important;
  font-size: 12px !important;
  border-radius: 12px !important;
  min-height: unset !important;
}

.auth-tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 14px;
  color: var(--duo-gray-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}
.auth-tab-btn:hover {
  color: var(--duo-blue);
}
.auth-tab-btn.active {
  color: var(--duo-blue-dark);
  border-bottom-color: var(--duo-blue);
}

.auth-saved-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.trainer-choice-btn {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--duo-gray-border);
  transition: all 0.15s;
}
.trainer-choice-btn:hover {
  background: #f7f9fa;
  border-color: var(--duo-blue);
}

.kz-avatar-fallback {
  font-size: 26px;
  display: inline-block;
  line-height: 1;
}

.warning {
  color: var(--duo-red-dark);
  font-weight: 700;
}

.grammar-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  border: 1px solid var(--duo-gray-border);
  border-radius: 12px;
  background: #ffffff;
}

/* ==========================================================================
   CLANS SYSTEM STYLES (QAZAQLINGO CLANS)
   ========================================================================== */
.clan-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* Hero Banner */
.clan-hero-banner {
  background: linear-gradient(135deg, #0288d1 0%, #005b9f 100%);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(2, 136, 209, 0.25);
}

.clan-hero-content {
  max-width: 580px;
  z-index: 2;
}

.clan-hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.clan-hero-title {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 10px;
  color: #ffffff;
}

.clan-hero-desc {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 20px;
}

.clan-hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.clan-hero-illustration {
  display: flex;
  gap: 12px;
  position: relative;
}

.clan-floating-emblem {
  font-size: 54px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
  animation: float-badge 3s ease-in-out infinite;
}
.clan-floating-emblem.delay-1 {
  animation-delay: 1s;
}
.clan-floating-emblem.delay-2 {
  animation-delay: 2s;
}

@keyframes float-badge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Clan Section Header */
.clan-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.clan-tabs-nav {
  display: flex;
  gap: 8px;
}

.clan-search-box input {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 12px;
}

/* Clan Cards Grid */
.clan-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.clan-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 4px 0 var(--duo-gray-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.clan-card:hover {
  transform: translateY(-2px);
  border-color: var(--duo-blue);
  box-shadow: 0 6px 0 var(--duo-blue-dark);
}

.clan-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.clan-card-badge-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #f0f7ff;
  border: 2px solid #cbe4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.clan-card-title-box {
  overflow: hidden;
}

.clan-card-name {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clan-card-leader {
  font-size: 12px;
  color: var(--duo-gray-dark);
  font-weight: 600;
}

.clan-card-desc {
  font-size: 13px;
  color: var(--duo-gray-text);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}

.clan-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}

.clan-card-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
}

.clan-tag-badge {
  background: #eef8ff;
  color: var(--duo-blue-dark);
  border: 1px solid #bde0fe;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.clan-tag-mini {
  background: #fff4e5;
  color: #b25e00;
  border: 1px solid #ffd8a8;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

/* Clan Dashboard (Affiliated User View) */
.clan-dashboard-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 0 var(--duo-gray-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.clan-dashboard-main {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex: 1;
  min-width: 280px;
}

.clan-large-emblem {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  background: #f0f7ff;
  border: 3px solid #bde0fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  box-shadow: 0 6px 16px rgba(2, 136, 209, 0.12);
  flex-shrink: 0;
}

.clan-dashboard-info {
  flex: 1;
}

.clan-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.clan-name-title {
  font-size: 22px;
  font-weight: 900;
  margin: 0;
}

.clan-description-text {
  color: var(--duo-gray-dark);
  font-size: 14px;
  margin: 0 0 14px 0;
  line-height: 1.45;
}

.clan-meta-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
}

.clan-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

/* Roster Table */
.clan-roster-container {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 0 var(--duo-gray-border);
}

.clan-roster-table {
  width: 100%;
  border-collapse: collapse;
}

.clan-roster-table th {
  background: #f8fafc;
  color: var(--duo-gray-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 18px;
  border-bottom: 2px solid var(--duo-gray-border);
  text-align: left;
}

.clan-roster-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  vertical-align: middle;
}

.clan-roster-table tr:last-child td {
  border-bottom: none;
}

.roster-rank-col {
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}

.roster-user-col {
  display: flex;
  align-items: center;
  gap: 10px;
}

.roster-avatar {
  font-size: 24px;
  line-height: 1;
}

.roster-username {
  font-weight: 800;
  color: #1a1a1a;
}

.role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.role-leader {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.role-member {
  background: #f1f5f9;
  color: #475569;
}

.roster-xp-col {
  text-align: right;
  font-weight: 800;
}

.my-clan-row {
  background: #e0f7fa !important;
}

/* Empty State */
.clan-empty-state {
  background: #ffffff;
  border: 2px dashed var(--duo-gray-border);
  border-radius: 18px;
  padding: 48px 24px;
  text-align: center;
  max-width: 440px;
  margin: 20px auto;
}

/* Creation Modal Emblems */
.clan-modal-window {
  max-width: 480px !important;
  max-height: 90dvh !important;
  display: flex !important;
  flex-direction: column !important;
}

.clan-modal-window .modal-body {
  overflow-y: auto !important;
  flex: 1 1 auto !important;
}

.duo-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--duo-gray-border);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--duo-text-dark);
  background: #f8fafc;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.duo-input:focus {
  border-color: var(--duo-blue);
  background: #ffffff;
}

.clan-emblem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.clan-emblem-option {
  border: 2px solid var(--duo-gray-border);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.15s ease;
  user-select: none;
}
.clan-emblem-option:hover {
  background: #f0f7ff;
  border-color: var(--duo-blue);
}
.clan-emblem-option.selected {
  background: #eef8ff;
  border-color: var(--duo-blue);
  box-shadow: 0 0 0 2px var(--duo-blue);
}

.clan-emblem-icon {
  font-size: 26px;
  margin-bottom: 4px;
}

.clan-emblem-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--duo-gray-dark);
}

@media (max-width: 768px) {
  .clan-hero-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    gap: 16px;
  }
  .clan-hero-illustration {
    display: none;
  }
  .clan-section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .clan-search-box,
  #clan-search-input {
    width: 100% !important;
  }
  .clan-dashboard-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
    gap: 14px;
  }
  .clan-dashboard-main {
    flex-direction: column;
    align-items: flex-start;
  }
  .clan-cards-grid {
    grid-template-columns: 1fr;
  }
  .clan-emblem-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   FULL DUOLINGO PROFILE PAGE (VIEW-PROFILE)
   ========================================================================== */
.duo-profile-page {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 32px;
}

.duo-profile-guest-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 20px;
  padding: 48px 24px;
  text-align: center;
}

.duo-profile-banner {
  position: relative;
  border-radius: 20px;
  overflow: visible;
  margin-bottom: 46px;
}

.duo-profile-banner-bg {
  width: 100%;
  aspect-ratio: 3.2 / 1;
  min-height: 155px;
  max-height: 230px;
  border-radius: 20px;
  background: linear-gradient(135deg, #38bdf8 0%, #bae6fd 60%, #fef3c7 100%);
  border: 2px solid #bae6fd;
  position: relative;
  overflow: hidden;
}

.duo-profile-banner-bg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.duo-profile-banner-badge {
  position: absolute;
  top: 12px;
  right: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.duo-profile-banner-content {
  position: relative;
  padding-left: 28px;
}

.duo-profile-avatar-wrap {
  position: absolute;
  top: -58px;
  left: 28px;
  width: 112px;
  height: 112px;
  cursor: pointer;
}

.duo-profile-avatar-circle {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: transform 0.15s ease;
}

.duo-profile-avatar-circle img {
  border-radius: 50%;
}

.duo-profile-avatar-wrap:hover .duo-profile-avatar-circle {
  transform: scale(1.04);
}

.duo-profile-avatar-edit-btn {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.duo-profile-avatar-edit-btn:hover {
  transform: scale(1.1);
  border-color: var(--duo-blue);
}

.duo-profile-identity-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 6px;
  border-bottom: 2px solid var(--duo-gray-border);
  padding-bottom: 20px;
}

.duo-profile-name {
  font-size: 26px;
  font-weight: 900;
  color: var(--duo-text-dark);
  margin: 0 0 4px;
  line-height: 1.2;
}

.duo-profile-handle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 700;
  color: var(--duo-gray-dark);
  margin-bottom: 10px;
}

.duo-profile-handle {
  color: var(--duo-gray-text);
}

.duo-profile-grade {
  background: #eef8ff;
  color: var(--duo-blue-dark);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.duo-profile-badges-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.duo-profile-clan-pill {
  border: 2px solid #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
  font-weight: 800;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.duo-profile-clan-pill:hover {
  background: #e0f2fe;
  transform: translateY(-1px);
}

.duo-profile-clan-pill.empty {
  border-color: var(--duo-gray-border);
  background: #ffffff;
  color: var(--duo-gray-dark);
}

.duo-profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.duo-profile-avatar-drawer {
  background: #ffffff;
  border: 2px solid var(--duo-blue);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(28, 176, 246, 0.12);
}

.duo-profile-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.duo-profile-section-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--duo-text-dark);
  margin: 0;
}

.duo-profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.duo-profile-stat-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s ease;
}

.duo-profile-stat-card:hover {
  border-color: #cbd5e1;
}

.duo-stat-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.duo-stat-value {
  font-size: 20px;
  font-weight: 900;
  color: var(--duo-text-dark);
  line-height: 1.1;
}

.duo-stat-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--duo-gray-dark);
  margin-top: 2px;
}

.duo-profile-course-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 16px;
  padding: 16px 18px;
}

.duo-achievements-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.duo-achievement-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.duo-ach-badge {
  width: 66px;
  height: 76px;
  border-radius: 14px;
  border: 2px solid;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
}

.duo-ach-emoji {
  font-size: 28px;
  line-height: 1;
}

.duo-ach-lvl {
  font-size: 10px;
  font-weight: 900;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.4px;
}

.duo-ach-body {
  flex: 1;
  min-width: 0;
}

.duo-ach-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.duo-ach-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--duo-text-dark);
}

.duo-ach-counter {
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  white-space: nowrap;
}

.duo-ach-desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--duo-gray-dark);
  margin-bottom: 10px;
}

.duo-ach-progress-track {
  width: 100%;
  height: 12px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.duo-ach-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.duo-profile-security-box {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 16px;
  padding: 14px 18px;
}

@media (max-width: 768px) {
  .qazaq-toast-banner {
    max-width: calc(100vw - 24px);
    text-align: center;
    font-size: 13px;
    padding: 10px 18px;
  }
  .duo-profile-banner {
    margin-bottom: 42px;
  }
  .duo-profile-banner-bg {
    aspect-ratio: 2.8 / 1;
    height: auto;
    min-height: 115px;
    max-height: 155px;
  }
  .duo-profile-avatar-wrap {
    top: -48px;
    left: 16px;
    width: 96px;
    height: 96px;
  }
  .duo-profile-avatar-circle {
    width: 96px;
    height: 96px;
  }
  .duo-profile-identity-row {
    flex-direction: column;
    align-items: stretch;
  }
  .duo-profile-stats-grid {
    grid-template-columns: 1fr;
  }
  .duo-frames-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .duo-profile-actions {
    width: 100%;
  }
  .duo-profile-actions .duo-btn {
    flex: 1;
  }
}

/* ==========================================================================
   UNLOCKABLE PROFILE FRAMES (РАМКИ ПРОФИЛЯ ЗА УРОКИ)
   ========================================================================== */
.header-avatar-frame {
  padding: 2px;
  transition: transform 0.15s ease;
}

@keyframes kz-frame-pulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.4)); }
  50% { filter: drop-shadow(0 0 11px rgba(250, 204, 21, 0.72)); }
}

.frame-none {
  border: 2px solid #e2e8f0 !important;
}

.frame-baishashek {
  background: linear-gradient(135deg, #ecfccb 0%, #6ee7b7 50%, #a7f3d0 100%) !important;
  border: 3px solid #10b981 !important;
  outline: 2px dashed #34d399;
  outline-offset: 2px;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.3) !important;
}

.frame-shanyrak {
  background: conic-gradient(from 45deg, #00afca, #fbbf24, #0d9488, #fde047, #00afca) !important;
  border: 3px solid #ffffff !important;
  box-shadow: 0 0 0 3px #00afca, 0 8px 22px rgba(0, 175, 202, 0.38) !important;
}

.frame-alatau {
  background: linear-gradient(135deg, #e0f2fe 0%, #38bdf8 50%, #0284c7 100%) !important;
  border: 3px solid #ffffff !important;
  box-shadow: 0 0 0 3px #0284c7, 0 0 18px rgba(56, 189, 248, 0.55) !important;
}

.frame-altyn {
  background: conic-gradient(from 0deg, #fef08a, #f59e0b, #fbbf24, #d97706, #fef08a) !important;
  border: 3px solid #ffffff !important;
  box-shadow: 0 0 0 3px #eab308, 0 0 22px rgba(245, 158, 11, 0.55) !important;
  animation: kz-frame-pulse 2.6s ease-in-out infinite;
}

.frame-tulpar {
  background: conic-gradient(from 90deg, #a855f7, #ec4899, #f59e0b, #8b5cf6, #a855f7) !important;
  border: 3px solid #ffffff !important;
  box-shadow: 0 0 0 3px #9333ea, 0 0 24px rgba(168, 85, 247, 0.52) !important;
  animation: kz-frame-pulse 2.4s ease-in-out infinite;
}

.frame-qazaq_star {
  background: conic-gradient(from 0deg, #00afca, #10b981, #fbbf24, #38bdf8, #00afca) !important;
  border: 3px solid #ffffff !important;
  outline: 2px solid #facc15;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px #059669, 0 0 26px rgba(16, 185, 129, 0.62) !important;
  animation: kz-frame-pulse 2s ease-in-out infinite;
}

.duo-frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 12px;
}

.duo-frame-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
  font-family: inherit;
}

.duo-frame-card.unlocked:hover {
  transform: translateY(-2px);
  border-color: var(--duo-blue);
}

.duo-frame-card.selected {
  background: #eef8ff;
  border-color: var(--duo-blue);
}

.duo-frame-card.locked {
  opacity: 0.72;
  background: #f8fafc;
}

.duo-frame-preview {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--duo-gray-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.duo-frame-lock {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.duo-frame-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-text-dark);
  text-align: center;
  line-height: 1.2;
}

.duo-frame-req {
  font-size: 11px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 999px;
}

.duo-frame-card.selected .duo-frame-req {
  background: var(--duo-blue);
  color: #ffffff;
}

.welcome-app-icon {
  width: 124px;
  height: 124px;
  border-radius: 28px;
  object-fit: cover;
  box-shadow: 0 10px 26px rgba(0, 149, 182, 0.28);
  border: 3px solid #ffffff;
  display: block;
  margin: 0 auto;
}
.welcome-app-icon-sm {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(0, 149, 182, 0.24);
  border: 2px solid #ffffff;
  display: block;
  margin: 0 auto 12px;
}

/* ==========================================================================
   PROFILE BANNERS COLLECTION & FRIENDS / GIFTS SYSTEM
   ========================================================================== */
.duo-banners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.duo-banner-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
  font-family: inherit;
}

.duo-banner-card.unlocked:hover,
.duo-banner-card.locked:hover {
  transform: translateY(-2px);
  border-color: var(--duo-blue);
}

.duo-banner-card.selected {
  background: #eef8ff;
  border-color: var(--duo-blue);
}

.duo-banner-thumb {
  width: 100%;
  aspect-ratio: 16 / 7;
  min-height: 64px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.12);
}

.duo-friends-box {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.duo-friends-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.duo-friends-empty {
  text-align: center;
  padding: 18px 12px;
  color: var(--duo-gray-text);
  font-size: 13px;
  font-weight: 700;
  background: #f8fafc;
  border-radius: 12px;
}

.duo-friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--duo-gray-border);
  border-radius: 14px;
  background: #ffffff;
  flex-wrap: wrap;
}

.duo-friend-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.duo-friend-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.duo-friend-name {
  font-weight: 900;
  font-size: 15px;
  color: var(--duo-text-dark);
}

.duo-friend-meta {
  font-size: 12px;
  font-weight: 700;
  color: var(--duo-gray-dark);
}

.duo-friend-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.duo-friend-actions .is-done {
  opacity: 0.65;
}

.duo-friend-remove {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 2px solid var(--duo-gray-border);
  background: #f8fafc;
  color: var(--duo-gray-text);
  font-weight: 900;
  cursor: pointer;
}

.duo-friend-remove:hover {
  border-color: var(--duo-red);
  color: var(--duo-red);
}

.duo-friends-discover {
  border-top: 2px solid var(--duo-gray-border);
  padding-top: 14px;
}

.duo-discover-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.duo-discover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f8fafc;
}

.league-friend-btn {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--duo-green);
  background: #e0f7fa;
  color: var(--duo-green-dark);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

.league-friend-btn.added {
  border-color: var(--duo-gray-border-dark);
  background: #f1f5f9;
  color: var(--duo-gray-dark);
}

.duo-profile-banner-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  display: block;
  filter: saturate(1.12) contrast(1.05);
}

.duo-profile-banner-tint {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 175, 202, 0.14) 0%, rgba(15, 23, 42, 0.34) 100%);
  pointer-events: none;
}

.duo-banner-thumb {
  position: relative;
  overflow: hidden;
}

.duo-banner-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  display: block;
  filter: saturate(1.15);
}

.duo-banner-thumb-icon {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 15px;
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}


@media (max-width: 768px) {
  .header-left {
    flex-shrink: 0 !important;
  }
  .header-left .course-selector {
    padding: 5px 8px !important;
    gap: 4px !important;
  }
  .header-left .course-selector span:nth-child(2) {
    display: none !important;
  }
  .header-stats {
    gap: 4px !important;
    min-width: 0 !important;
    flex-wrap: nowrap !important;
  }
  .stat-item {
    padding: 3px 6px !important;
    font-size: 11px !important;
  }
  #header-user-btn {
    margin-left: 0 !important;
    padding: 3px 6px !important;
    max-width: 96px !important;
  }
  .unit-header-top {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .lesson-node-wrapper {
    margin-left: auto !important;
    margin-right: auto !important;
  }
}
@media (max-width: 420px) {
  #header-user-btn span:last-child {
    display: none !important;
  }
}

/* ==========================================================================
   CLAN WEEKLY QUEST, CLAN CHAT & WORD_LETTERS TILES
   ========================================================================== */
.clan-quest-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 18px;
  padding: 16px 18px;
}

.clan-chat-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clan-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.clan-chat-msg {
  background: #f8fafc;
  border: 1.5px solid var(--duo-gray-border);
  border-radius: 14px;
  padding: 10px 14px;
  max-width: 85%;
  align-self: flex-start;
}

.clan-chat-msg.mine {
  background: #e0f7fa;
  border-color: var(--duo-green);
  align-self: flex-end;
}

.clan-chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--duo-gray-dark);
  margin-bottom: 4px;
}

.clan-chat-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--duo-text-dark);
  word-break: break-word;
}

.clan-chat-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.clan-chat-form .auth-input {
  flex: 1;
  padding: 10px 14px;
}

.letter-chip {
  min-width: 44px;
  height: 46px;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 900;
  justify-content: center;
}

.letter-answer-slots {
  justify-content: center;
  min-height: 62px;
}

/* ==========================================================================
   LEAGUE DIVISIONS BAR & STREAK CELEBRATION MODAL
   ========================================================================== */
.league-divisions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.league-div-pill {
  flex: 1;
  min-width: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 2px solid var(--duo-gray-border);
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  white-space: nowrap;
}

.league-div-pill.active {
  border-color: var(--duo-green);
  background: #e0f7fa;
  color: var(--duo-green-dark);
  box-shadow: 0 4px 12px rgba(0, 175, 202, 0.2);
}

.league-div-pill.locked {
  opacity: 0.55;
  background: #f8fafc;
}

.streak-modal-window {
  max-width: 420px;
  padding: 28px 24px;
  text-align: center;
}

.streak-celebration-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.streak-flame-hero {
  font-size: 74px;
  line-height: 1;
  animation: streakFlamePop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 8px 18px rgba(255, 150, 0, 0.45));
}

@keyframes streakFlamePop {
  0% { transform: scale(0.3) rotate(-12deg); opacity: 0; }
  70% { transform: scale(1.15) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.streak-count-big {
  font-size: 32px;
  font-weight: 900;
  color: #e65100;
  line-height: 1.1;
}

.streak-subtitle {
  font-size: 14px;
  font-weight: 700;
  color: var(--duo-gray-dark);
  line-height: 1.45;
  max-width: 320px;
}

.streak-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: 100%;
  background: #fff8e1;
  border: 2px solid #ffe082;
  border-radius: 18px;
  padding: 14px 10px;
  margin: 4px 0 8px;
}

.streak-day-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.streak-day-label {
  font-size: 12px;
  font-weight: 900;
  color: var(--duo-gray-dark);
}

.streak-day-col.today .streak-day-label {
  color: #e65100;
}

.streak-day-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.streak-day-circle.done {
  background: linear-gradient(135deg, #ffb020 0%, #ff6b00 100%);
  box-shadow: 0 3px 10px rgba(255, 107, 0, 0.35);
}

.streak-day-col.today .streak-day-circle.done {
  outline: 3px solid rgba(255, 150, 0, 0.35);
}

.league-zone-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  margin-left: 4px;
}

.league-zone-pill.promo {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.league-zone-pill.releg {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* Turquoise Streak Flame & Inactive Gray State */
.stat-fire {
  color: #00afca !important;
}

.stat-fire.inactive {
  color: #94a3b8 !important;
  background: #f1f5f9 !important;
}

.streak-flame-hero {
  filter: drop-shadow(0 8px 18px rgba(0, 175, 202, 0.4)) !important;
}

.streak-count-big {
  color: #008b9e !important;
}

.streak-week-grid {
  background: #ecfeff !important;
  border-color: #a5f3fc !important;
}

.streak-day-col.today .streak-day-label {
  color: #008b9e !important;
}

.streak-day-circle.done {
  background: linear-gradient(135deg, #22d3ee 0%, #008b9e 100%) !important;
  box-shadow: 0 3px 10px rgba(0, 175, 202, 0.35) !important;
}

.streak-day-col.today .streak-day-circle.done {
  outline: 3px solid rgba(0, 175, 202, 0.35) !important;
}

/* Duolingo-Style Streak Ignition Stage */
.streak-ignite-stage {
  position: relative;
  width: 120px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.streak-shockwave {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid #22d3ee;
  opacity: 0;
  pointer-events: none;
}

.streak-ignite-stage.ignited .streak-shockwave {
  animation: streakShockwave 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes streakShockwave {
  0% { transform: scale(0.5); opacity: 0.95; border-width: 6px; }
  100% { transform: scale(1.75); opacity: 0; border-width: 1px; }
}

.streak-sparks span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22d3ee;
  opacity: 0;
  pointer-events: none;
}

.streak-ignite-stage.ignited .streak-sparks span:nth-child(1) { animation: sparkFly1 0.7s ease-out forwards; background: #00afca; }
.streak-ignite-stage.ignited .streak-sparks span:nth-child(2) { animation: sparkFly2 0.7s ease-out forwards; background: #fec50c; }
.streak-ignite-stage.ignited .streak-sparks span:nth-child(3) { animation: sparkFly3 0.7s ease-out forwards; background: #22d3ee; }
.streak-ignite-stage.ignited .streak-sparks span:nth-child(4) { animation: sparkFly4 0.7s ease-out forwards; background: #fec50c; }
.streak-ignite-stage.ignited .streak-sparks span:nth-child(5) { animation: sparkFly5 0.7s ease-out forwards; background: #00afca; }
.streak-ignite-stage.ignited .streak-sparks span:nth-child(6) { animation: sparkFly6 0.7s ease-out forwards; background: #7ce8f5; }

@keyframes sparkFly1 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(-52px,-46px) scale(0.2); } }
@keyframes sparkFly2 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(46px,-48px) scale(0.2); } }
@keyframes sparkFly3 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(-62px, 6px) scale(0.2); } }
@keyframes sparkFly4 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(56px, 8px) scale(0.2); } }
@keyframes sparkFly5 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(-28px,-62px) scale(0.2); } }
@keyframes sparkFly6 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(26px,-60px) scale(0.2); } }

.streak-flame-hero.is-dormant {
  transform: scale(0.88);
  filter: grayscale(0.4) opacity(0.8) !important;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.streak-flame-hero.is-ignited {
  animation: flameIgniteBounce 0.65s cubic-bezier(0.34, 1.56, 0.64, 1), flameFlicker 2.2s ease-in-out 0.65s infinite;
}

@keyframes flameIgniteBounce {
  0% { transform: scale(0.75) rotate(-8deg); }
  45% { transform: scale(1.24) rotate(5deg); }
  75% { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes flameFlicker {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 8px 18px rgba(0, 175, 202, 0.45)); }
  50% { transform: scale(1.04) rotate(1.5deg); filter: drop-shadow(0 12px 24px rgba(34, 211, 238, 0.65)); }
}

.streak-count-big.pop {
  animation: countPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes countPop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.streak-day-circle.ignite-pop {
  animation: countPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Friend DM Modal (Preset Messages) */
.dm-modal-window {
  max-width: 480px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 86vh;
}

.dm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 2px solid var(--duo-gray-border);
  background: #ffffff;
}

.dm-chat-scroll {
  padding: 14px 18px;
  flex: 1;
  min-height: 180px;
  max-height: 280px;
  background: #f8fafc;
}

.dm-presets-section {
  padding: 14px 18px 18px;
  border-top: 2px solid var(--duo-gray-border);
  background: #ffffff;
}

.dm-presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.dm-preset-btn {
  text-align: left;
  padding: 9px 10px;
  border-radius: 12px;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 3px;
  background: #ffffff;
  color: var(--duo-text-dark);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.dm-preset-btn:hover {
  border-color: var(--duo-green);
  background: #e0f7fa;
}

.dm-preset-btn:active {
  transform: translateY(2px);
}

@media (max-width: 520px) {
  .dm-presets-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   UPGRADED GORGEOUS PROFILE FRAMES (ORNAMENTAL RINGS + UNIQUE EMBLEMS)
   ========================================================================== */
.frame-baishashek,
.frame-shanyrak,
.frame-korkem,
.frame-alatau,
.frame-koktem,
.frame-altyn,
.frame-khan_shatyr,
.frame-tulpar,
.frame-qazaq_star {
  position: relative !important;
  overflow: visible !important;
}

.duo-frame-preview img,
.duo-profile-avatar-circle img {
  border-radius: 50%;
}

.frame-baishashek:not(:has(.duo-frame-lock))::after,
.frame-shanyrak:not(:has(.duo-frame-lock))::after,
.frame-korkem:not(:has(.duo-frame-lock))::after,
.frame-alatau:not(:has(.duo-frame-lock))::after,
.frame-koktem:not(:has(.duo-frame-lock))::after,
.frame-altyn:not(:has(.duo-frame-lock))::after,
.frame-khan_shatyr:not(:has(.duo-frame-lock))::after,
.frame-tulpar:not(:has(.duo-frame-lock))::after,
.frame-qazaq_star:not(:has(.duo-frame-lock))::after {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.22);
  z-index: 4;
  pointer-events: none;
}

.duo-profile-avatar-circle[class*="frame-"]:not(.frame-none)::after {
  width: 34px;
  height: 34px;
  top: -6px;
  right: -6px;
  font-size: 18px;
}

.duo-friend-avatar[class*="frame-"]:not(.frame-none)::after {
  display: none !important;
  content: none !important;
}

.frame-baishashek {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='none' stroke='%23ffffff' stroke-width='3' stroke-dasharray='4 6' opacity='0.9'/%3E%3C/svg%3E"),
    conic-gradient(from 45deg, #a7f3d0, #10b981, #6ee7b7, #059669, #a7f3d0) !important;
  border: 3px solid #ffffff !important;
  outline: 3px solid #10b981 !important;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.45) !important;
}
.frame-baishashek:not(:has(.duo-frame-lock))::after { content: '🌱'; border: 2px solid #10b981; }

.frame-shanyrak {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='none' stroke='%23fef08a' stroke-width='3.5' stroke-dasharray='10 4'/%3E%3C/svg%3E"),
    conic-gradient(from 0deg, #00afca, #fec50c, #00c4e0, #fde047, #00afca) !important;
  border: 3px solid #ffffff !important;
  outline: 3px solid #00afca !important;
  box-shadow: 0 0 22px rgba(0, 175, 202, 0.48) !important;
}
.frame-shanyrak:not(:has(.duo-frame-lock))::after { content: '☀️'; border: 2px solid #f59e0b; }

.frame-korkem {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='none' stroke='%23ffffff' stroke-width='3' stroke-dasharray='3 3'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #06b6d4 0%, #cffafe 50%, #0e7490 100%) !important;
  border: 3px solid #ffffff !important;
  outline: 3px dashed #0891b2 !important;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.5) !important;
}
.frame-korkem:not(:has(.duo-frame-lock))::after { content: '💠'; border: 2px solid #06b6d4; }

.frame-alatau {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='none' stroke='%23e0f2fe' stroke-width='3.5' stroke-dasharray='12 5'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #e0f2fe 0%, #38bdf8 50%, #0369a1 100%) !important;
  border: 3px solid #ffffff !important;
  outline: 3px solid #0284c7 !important;
  box-shadow: 0 0 24px rgba(2, 132, 199, 0.5) !important;
}
.frame-alatau:not(:has(.duo-frame-lock))::after { content: '🏔️'; border: 2px solid #0284c7; }

.frame-koktem {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-dasharray='2 6' stroke-linecap='round'/%3E%3C/svg%3E"),
    conic-gradient(from 90deg, #fbcfe8, #fef08a, #a7f3d0, #f472b6, #fbcfe8) !important;
  border: 3px solid #ffffff !important;
  outline: 3px solid #ec4899 !important;
  box-shadow: 0 0 22px rgba(236, 72, 153, 0.45) !important;
}
.frame-koktem:not(:has(.duo-frame-lock))::after { content: '🌸'; border: 2px solid #ec4899; }

.frame-altyn {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='none' stroke='%23fffbeb' stroke-width='4' stroke-dasharray='8 4'/%3E%3C/svg%3E"),
    conic-gradient(from 0deg, #fef08a, #f59e0b, #fffbeb, #b45309, #fef08a) !important;
  border: 3px solid #ffffff !important;
  outline: 3px solid #eab308 !important;
  box-shadow: 0 0 26px rgba(234, 179, 8, 0.6) !important;
}
.frame-altyn:not(:has(.duo-frame-lock))::after { content: '👑'; border: 2px solid #eab308; background: #fffbeb; }

.frame-khan_shatyr {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='none' stroke='%23fef08a' stroke-width='3' stroke-dasharray='14 4'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #fec50c 0%, #ef4444 50%, #991b1b 100%) !important;
  border: 3px solid #ffffff !important;
  outline: 3px solid #dc2626 !important;
  box-shadow: 0 0 24px rgba(220, 38, 38, 0.5) !important;
}
.frame-khan_shatyr:not(:has(.duo-frame-lock))::after { content: '⛺'; border: 2px solid #dc2626; }

.frame-tulpar {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='none' stroke='%23fde047' stroke-width='3.5' stroke-dasharray='6 5'/%3E%3C/svg%3E"),
    conic-gradient(from 120deg, #c084fc, #fec50c, #7e22ce, #fde047, #c084fc) !important;
  border: 3px solid #ffffff !important;
  outline: 3px solid #9333ea !important;
  box-shadow: 0 0 26px rgba(147, 51, 234, 0.55) !important;
}
.frame-tulpar:not(:has(.duo-frame-lock))::after { content: '🐎'; border: 2px solid #9333ea; }

.frame-qazaq_star {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='46' fill='none' stroke='%23ffffff' stroke-width='4' stroke-dasharray='10 4 2 4'/%3E%3C/svg%3E"),
    conic-gradient(from 0deg, #00afca, #fec50c, #10b981, #38bdf8, #fec50c, #00afca) !important;
  border: 3px solid #ffffff !important;
  outline: 3px solid #00afca !important;
  box-shadow: 0 0 30px rgba(0, 175, 202, 0.65) !important;
  animation: frameGlowPulse 2.8s ease-in-out infinite;
}
.frame-qazaq_star:not(:has(.duo-frame-lock))::after { content: '🌟'; border: 2px solid #f59e0b; background: #fffbeb; }

@keyframes frameGlowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 175, 202, 0.45); }
  50% { box-shadow: 0 0 32px rgba(254, 197, 12, 0.75); }
}

.dm-presets-grid {
  max-height: 185px;
  overflow-y: auto;
  padding-right: 2px;
}

@media (max-width: 768px) {
  /* Compact Mobile UI */
  .content-body {
    padding: 10px 10px 72px !important;
  }
  .clan-hero-banner,
  .leaderboard-header-banner {
    padding: 16px 14px !important;
    margin-bottom: 12px !important;
  }
  .clan-hero-title,
  .league-title-main {
    font-size: 20px !important;
  }
  .duo-profile-page {
    gap: 14px !important;
  }
  .duo-profile-section-title {
    font-size: 16px !important;
    margin-bottom: 8px !important;
  }
  .duo-friend-row {
    padding: 8px 10px !important;
    gap: 8px !important;
  }
  .duo-friend-actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Locked Non-Scrolling Mobile Lesson View */
  .lesson-screen.active {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .lesson-header {
    height: 48px !important;
    padding: 0 12px !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
  }
  .lesson-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 8px 12px 8px !important;
    justify-content: flex-start !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
  .lesson-question-title {
    font-size: 17px !important;
    margin-bottom: 10px !important;
    line-height: 1.25 !important;
  }
  .dialogue-prompt-row {
    margin-bottom: 10px !important;
    gap: 10px !important;
  }
  #dialogue-mascot svg {
    width: 44px !important;
    height: 44px !important;
  }
  .prompt-speech-bubble {
    padding: 8px 12px !important;
    font-size: 14px !important;
  }
  .word-answer-slots {
    min-height: 48px !important;
    padding: 8px !important;
    margin-bottom: 10px !important;
    gap: 6px !important;
  }
  .word-bank-chips {
    gap: 6px !important;
  }
  .word-chip {
    padding: 7px 11px !important;
    font-size: 13px !important;
  }
  .letter-chip {
    min-width: 38px !important;
    height: 40px !important;
    font-size: 16px !important;
  }
  .choice-card {
    padding: 10px 12px !important;
    font-size: 14px !important;
    margin-bottom: 8px !important;
  }
  .pair-grid-container {
    gap: 8px !important;
  }
  .pair-card {
    padding: 9px 8px !important;
    font-size: 13px !important;
    min-height: 40px !important;
  }
  .lesson-footer-drawer {
    position: static !important;
    flex-shrink: 0 !important;
    padding: 10px 12px !important;
    gap: 8px !important;
  }
}


.msg-censored {
  filter: blur(5px);
  user-select: none;
  display: inline-block;
  padding: 0 2px;
}

/* Prevent background page scrollbar leaking behind fullscreen overlays */
html:has(.lesson-screen.active),
body:has(.lesson-screen.active),
html:has(.welcome-overlay.active),
body:has(.welcome-overlay.active) {
  overflow: hidden !important;
}

.welcome-overlay.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.welcome-card {
  margin: auto;
}

@media (max-width: 768px) {
  .content-body {
    padding-bottom: 92px !important;
  }
  .league-mode-tabs,
  .league-tabs-row,
  .friends-tabs-bar,
  .duo-friends-tabs,
  .preset-filters-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .league-mode-tab,
  .friends-tab-btn,
  .duo-friends-tab {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    padding: 8px 10px !important;
  }
  .league-friend-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  /* Visual cue that mobile bottom nav scrolls horizontally */
  .left-sidebar {
    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 92%, transparent 100%);
    mask-image: linear-gradient(to right, #000 0%, #000 92%, transparent 100%);
    padding-right: 24px !important;
  }
}

/* ==========================================================================
   1. INTERACTIVE KAZAKHSTAN JOURNEY MAP (Карта Казахстана вместо змейки)
   ========================================================================== */
.kz-journey-map-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 22px;
  padding: 18px 20px;
  margin-bottom: 24px;
  box-shadow: 0 6px 20px rgba(0, 175, 202, 0.08);
}

.kz-map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.kz-map-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  color: #007d91;
  background: #d4f6fc;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.kz-map-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--duo-text-dark);
}

.kz-map-hint {
  font-size: 12px;
  font-weight: 700;
  color: var(--duo-gray-text);
}

.kz-map-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 800 / 380;
  background: radial-gradient(circle at 50% 40%, #f8fafc 0%, #eef8ff 100%);
  border-radius: 16px;
  border: 2px solid #e0f2fe;
  overflow: hidden;
}

.kz-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.kz-map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  cursor: pointer;
  z-index: 3;
  transition: transform 0.15s ease;
}

.kz-map-pin:hover {
  transform: translate(-50%, -55%) scale(1.06);
  z-index: 5;
}

.kz-map-pin-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #00afca;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 900;
  color: #008b9e;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.kz-map-pin.done .kz-map-pin-dot {
  background: #10b981;
  border-color: #059669;
  color: #ffffff;
}

.kz-map-pin.active .kz-map-pin-dot {
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 175, 202, 0.35), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.kz-map-pin.locked .kz-map-pin-dot {
  background: #f1f5f9;
  border-color: #cbd5e1;
  opacity: 0.85;
}

.kz-map-pin-label {
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  color: var(--duo-text-dark);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.kz-map-pin-label b {
  color: #008b9e;
  margin-left: 3px;
}

.kz-region-card {
  margin-bottom: 26px;
}

.kz-region-trail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px 26px;
  padding: 28px 18px 20px;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-top: none;
  border-radius: 0 0 20px 20px;
  position: relative;
}

.kz-themed-unit {
  position: relative;
  border: 2px solid var(--duo-gray-border);
  border-radius: 24px;
  padding: 16px 16px 26px;
  margin-bottom: 28px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: visible;
}

.kz-scenery-layer {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.kz-trail-stage {
  position: relative;
  width: 100%;
  overflow: visible;
  margin-top: 8px;
}

.kz-scenery-layer {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.kz-scenery-backdrop-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 185px;
  pointer-events: none;
  z-index: 1;
}

.kz-scenery-ground {
  position: absolute;
  top: 180px;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.kz-scenery-ground-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
}

.kz-scenery-prop {
  position: absolute;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.16));
  user-select: none;
  z-index: 2;
}

.kz-trail-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
}

@media (max-width: 768px) {
  .kz-scenery-prop {
    transform: scale(0.68);
    transform-origin: top center;
  }
  .kz-scenery-prop[style*="left:"] {
    transform-origin: top left;
  }
  .kz-scenery-prop[style*="right:"] {
    transform-origin: top right;
  }
}

.kz-themed-flow {
  padding-top: 22px;
}

.kz-themed-flow .path-node-wrapper {
  position: relative;
  z-index: 2;
}

.kz-themed-label {
  background: rgba(255, 255, 255, 0.94);
  padding: 3px 10px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

@media (max-width: 768px) {
  .kz-themed-unit {
    padding: 10px 10px 20px;
    border-radius: 18px;
    margin-bottom: 20px;
  }
}

.kz-trail-mascot {
  top: -54px !important;
  right: -18px !important;
}

@media (max-width: 768px) {
  .kz-journey-map-card {
    padding: 12px;
    margin-bottom: 16px;
  }
  .kz-map-pin-dot {
    width: 28px;
    height: 28px;
    font-size: 13px;
    border-width: 2px;
  }
  .kz-map-pin-label {
    font-size: 9px;
    padding: 1px 4px;
  }
  .kz-region-trail {
    gap: 16px 14px;
    padding: 22px 10px 16px;
  }
  .kz-trail-node {
    width: 78px;
  }
}

/* ==========================================================================
   2. MINI-GAME: «ПАДЕЖНЫЙ ТЕТРИС» (games.js)
   ========================================================================== */
.games-page-wrap {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.games-hero-banner {
  background: linear-gradient(135deg, #00afca 0%, #0284c7 100%);
  color: #ffffff;
  border-radius: 20px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 6px 0 #007d91;
}

.games-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.22);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.6px;
}

.games-best-pill {
  background: rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 14px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.tetris-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.tetris-stat {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
}

.tetris-arena {
  position: relative;
  height: 360px;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
  border: 2px solid #bae6fd;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tetris-target-bar {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 800;
  z-index: 3;
}

.tetris-case-pill {
  background: #fec50c;
  color: #0f172a;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
}

.tetris-falling-layer {
  position: relative;
  flex: 1;
  width: 100%;
}

.tetris-start-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.9);
}

.tetris-word-block {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #00afca 0%, #0284c7 100%);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 16px;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 5px 0 #0369a1, 0 10px 20px rgba(2, 132, 199, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tetris-word-slot {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 18px;
}

.tetris-word-block.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 5px 0 #047857;
}

.tetris-word-block.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 5px 0 #b91c1c;
}

.tetris-feedback-flash {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
.tetris-feedback-flash.show.ok {
  opacity: 1;
  background: #d1fae5;
  color: #065f46;
}
.tetris-feedback-flash.show.err {
  opacity: 1;
  background: #fee2e2;
  color: #991b1b;
}

.tetris-platforms {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.tetris-platform-btn {
  background: #ffffff;
  border: 2px solid var(--duo-blue);
  border-bottom-width: 5px;
  border-radius: 16px;
  padding: 14px 10px;
  font-size: 18px;
  font-weight: 900;
  color: var(--duo-blue-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s ease, background 0.12s ease;
}

.tetris-platform-btn:hover:not(:disabled) {
  background: #eef8ff;
  transform: translateY(-2px);
}

.tetris-platform-btn:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.tetris-key-hint {
  font-size: 11px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 6px;
  border-radius: 6px;
}

@media (max-width: 768px) {
  .tetris-hud {
    grid-template-columns: repeat(2, 1fr);
  }
  .tetris-arena {
    height: 290px;
  }
  .tetris-platforms {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   3. LESSON EXERCISE: «ИСПРАВЬ ОШИБКУ В ТЕТРАДИ» (fix_mistake)
   ========================================================================== */
.notebook-card {
  background: repeating-linear-gradient(
    #fffdf7,
    #fffdf7 34px,
    #dbeafe 35px
  );
  border: 2px solid #cbd5e1;
  border-left: 6px solid #f87171;
  border-radius: 16px;
  padding: 18px 20px 22px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  margin-bottom: 18px;
}

.notebook-header {
  font-size: 12px;
  font-weight: 900;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.notebook-sentence {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notebook-word-token {
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 17px;
  font-weight: 800;
  color: var(--duo-text-dark);
  transition: all 0.12s ease;
}

.notebook-word-token:hover {
  border-color: var(--duo-blue);
  background: #eef8ff;
}

.notebook-word-token.picked-wrong {
  border-color: #ef4444;
  background: #fee2e2;
  color: #b91c1c;
  text-decoration: line-through;
}

.notebook-word-token.picked-wrong.picked-fixed {
  border-color: #10b981;
  background: #d1fae5;
  color: #065f46;
  text-decoration: none;
}

.notebook-fix-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notebook-step-hint {
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-gray-text);
}

.notebook-options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================================================================
   4. GAMES HUB CARDS, ARCADE TETRIS, SOR/SOCH SIMULATOR & KAHOOT CLAN WARS
   ========================================================================== */
.games-mode-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.games-mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 5px;
  border-radius: 18px;
  padding: 12px 16px;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.games-mode-card:hover {
  transform: translateY(-2px);
  border-color: #7dd3fc;
}

.games-mode-card.active {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
  border-color: var(--duo-blue);
  box-shadow: 0 6px 18px rgba(28, 176, 246, 0.16);
}

.games-mode-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

.games-mode-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.games-mode-meta strong {
  font-size: 15px;
  font-weight: 900;
  color: var(--duo-text-dark);
}

.games-mode-meta small {
  font-size: 12px;
  font-weight: 700;
  color: var(--duo-gray-text);
}

/* Arcade grid upgrade for Tetris Arena */
.tetris-arena {
  background-color: #0f172a !important;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.08) 1px, transparent 1px) !important;
  background-size: 28px 28px !important;
  border: 2px solid #0284c7 !important;
  box-shadow: inset 0 0 32px rgba(2, 132, 199, 0.25) !important;
}

.tetris-start-overlay {
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(6px);
}

@media (max-width: 600px) {
  .games-mode-cards {
    grid-template-columns: 1fr;
  }
}

.sor-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.sor-choice-card,
.sor-exam-card,
.sor-result-card,
.cw-lobby-card,
.cw-arena-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 20px;
  padding: 20px;
}

.sor-exam-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sor-sec-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  background: #ede9fe;
  color: #6d28d9;
  padding: 3px 10px;
  border-radius: 999px;
}

.sor-timer-pill {
  background: #fef3c7;
  color: #b45309;
  border: 1.5px solid #fde68a;
  border-radius: 12px;
  padding: 6px 12px;
  font-weight: 900;
  font-size: 15px;
}

.sor-nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.sor-nav-pill {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  font-weight: 800;
  font-size: 13px;
}

.sor-nav-pill.answered {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.sor-nav-pill.current {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1e40af;
}

.sor-passage-box {
  background: #f8fafc;
  border-left: 4px solid #6366f1;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 14px;
}

.sor-question-text {
  font-size: 17px;
  font-weight: 900;
  margin-bottom: 14px;
}

.sor-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.sor-option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
}

.sor-option-btn.selected {
  background: #eef8ff;
  border-color: var(--duo-blue);
  color: var(--duo-blue-dark);
}

.sor-opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}

.sor-footer-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.sor-result-card {
  text-align: center;
}

.sor-grade-pill {
  display: inline-block;
  background: #d1fae5;
  color: #065f46;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 900;
  margin-top: 8px;
}

.sor-review-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin-top: 12px;
}

.sor-review-row {
  border-radius: 12px;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
}
.sor-review-row.ok { background: #f0fdf4; border-color: #86efac; }
.sor-review-row.bad { background: #fef2f2; border-color: #fca5a5; }

/* Kahoot Clan Wars */
.cw-vs-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.cw-team-box {
  padding: 10px 16px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 14px;
}
.cw-team-box.mine { background: #e0f2fe; color: #0369a1; border: 2px solid #7dd3fc; }
.cw-team-box.enemy { background: #fce7f3; color: #be185d; border: 2px solid #f9a8d4; }

.cw-vs-badge {
  background: #0f172a;
  color: #fec50c;
  font-weight: 900;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.cw-rivals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.cw-scoreboard-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.cw-score-pill {
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}
.cw-score-pill.mine { background: #e0f2fe; color: #0369a1; }
.cw-score-pill.enemy { background: #fce7f3; color: #be185d; }

.cw-round-pill {
  font-weight: 900;
  font-size: 13px;
  color: var(--duo-gray-dark);
}

.cw-timer-bar-wrap {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.cw-timer-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981);
  transition: width 0.9s linear;
}

.cw-question-box {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  font-size: 19px;
  font-weight: 900;
  margin-bottom: 16px;
}

.cw-kahoot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.cw-kahoot-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px;
  border-radius: 16px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  text-align: left;
  border-bottom: 5px solid rgba(0, 0, 0, 0.25);
  transition: transform 0.1s ease;
}
.cw-kahoot-btn:hover:not(:disabled) { transform: translateY(-2px); }
.cw-kahoot-btn.kahoot-red { background: #e11d48; }
.cw-kahoot-btn.kahoot-blue { background: #2563eb; }
.cw-kahoot-btn.kahoot-gold { background: #d97706; }
.cw-kahoot-btn.kahoot-green { background: #059669; }
.cw-kahoot-btn.cw-correct { box-shadow: 0 0 0 4px #10b981; transform: scale(1.02); }
.cw-kahoot-btn.cw-wrong { box-shadow: 0 0 0 4px #ef4444; }

.cw-shape {
  font-size: 20px;
  flex-shrink: 0;
}
.cw-opt-text { flex: 1; }
.cw-key-num {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 7px;
  border-radius: 6px;
}

.cw-round-feedback {
  margin-top: 12px;
  text-align: center;
}
.cw-fb {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 13px;
}
.cw-fb.ok { background: #d1fae5; color: #065f46; }
.cw-fb.err { background: #fee2e2; color: #991b1b; }

@media (max-width: 768px) {
  .cw-kahoot-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   5. STEPPE TIME-OF-DAY, TRAVELER'S PASSPORT, NICK EFFECTS & MASCOT REACT
   ========================================================================== */
.steppe-time-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.steppe-time-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-gray-dark);
}

.steppe-time-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.steppe-time-pill {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  transition: all 0.12s ease;
}

.steppe-time-pill.active {
  background: #00afca;
  border-color: #008b9e;
  color: #ffffff;
}

.kz-night-mode .node-btn.locked {
  background: rgba(255, 255, 255, 0.22);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.35);
}

/* Traveler's Passport Stamps */
.passport-stamps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.passport-stamp-card {
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.72;
}

.passport-stamp-card.unlocked {
  border-style: solid;
  border-color: #00afca;
  background: linear-gradient(180deg, #f0fdff 0%, #ffffff 100%);
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0, 175, 202, 0.12);
}

.passport-stamp-seal {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px double #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transform: rotate(-8deg);
}

.passport-stamp-card.unlocked .passport-stamp-seal {
  border-color: #00afca;
  background: #d4f6fc;
}

.passport-stamp-name {
  font-size: 13px;
  font-weight: 900;
  color: var(--duo-text-dark);
}

.passport-stamp-desc {
  font-size: 11px;
  font-weight: 700;
  color: var(--duo-gray-text);
}

.passport-stamp-card.unlocked .passport-stamp-desc {
  color: #008b9e;
}

/* Custom Nickname Styles & Titles */
.nick-style-cyan {
  background: linear-gradient(90deg, #00afca, #0284c7, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

.nick-style-gold {
  background: linear-gradient(90deg, #d97706, #f59e0b, #eab308);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

.nick-style-fire {
  background: linear-gradient(90deg, #ef4444, #f97316, #eab308);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

.duo-profile-custom-title {
  display: inline-block;
  margin: 4px 0 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1.5px solid #f59e0b;
  color: #92400e;
  font-size: 12px;
  font-weight: 900;
}

/* Interactive Mascot Pop Animation */
@keyframes mascotReactPop {
  0% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(1.16) rotate(-8deg); }
  65% { transform: scale(1.1) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.mascot-react-pop {
  animation: mascotReactPop 0.48s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   6. FULL QA BUGFIX POLISH (GAMES, SOR/SOCH, PASSPORT, DICTIONARY, MOBILE)
   ========================================================================== */
.games-page-wrap {
  width: 100%;
  box-sizing: border-box;
}

.games-hero-banner {
  margin-bottom: 6px;
}

.sor-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

.sor-choice-card {
  min-width: 0;
}

.sor-grade-pill.low {
  background: #fee2e2;
  color: #b91c1c;
}

.tetris-exit-btn {
  background: #fff5f5;
  border: 2px solid #fecaca;
  color: #b91c1c;
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.passport-stamps-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-title {
  gap: 8px;
}

#confetti-canvas {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  pointer-events: none !important;
  z-index: 9999 !important;
}

.unit-switcher-nav,
.unit-tabs-row,
.dict-filters,
.tb-tabs {
  flex-wrap: wrap !important;
  overflow-x: visible !important;
  gap: 8px !important;
}

.pair-grid-container {
  align-items: stretch;
}
.pair-card {
  height: 100%;
}

@media (max-width: 640px) {
  .sor-cards-grid {
    grid-template-columns: 1fr;
  }
  .passport-stamps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .games-page-wrap {
    padding-bottom: 110px !important;
    gap: 10px !important;
  }
  .games-mode-cards {
    gap: 8px !important;
  }
  .games-mode-card {
    padding: 8px 12px !important;
  }
  .tetris-arena {
    height: 175px !important;
  }
  .games-hero-banner {
    padding: 10px 14px !important;
    gap: 10px !important;
  }
  .games-hero-banner h1 {
    font-size: 17px !important;
  }
  .games-hero-banner p {
    display: none !important;
  }
  .tetris-stat {
    padding: 6px 10px !important;
    font-size: 12px !important;
  }
  .tetris-platform-btn {
    padding: 10px 8px !important;
    font-size: 15px !important;
  }
  .auth-tab-btn {
    padding: 8px 6px !important;
    font-size: 12px !important;
  }
  .path-mascot-companion {
    left: -74px !important;
    top: -12px !important;
    transform: scale(0.72);
    transform-origin: center right;
  }
  .mascot-speech-bubble {
    position: relative !important;
    left: 8px !important;
    font-size: 11px !important;
    padding: 4px 8px !important;
    white-space: nowrap !important;
    max-width: 112px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* ==========================================================================
   7. KAZAKH LETTERS TRAINER, DAILY PHRASE & FINAL POLISH
   ========================================================================== */
.kz-letters-trainer {
  background: linear-gradient(135deg, #f0fdff 0%, #ffffff 100%);
  border: 2px solid #bae6fd;
  border-radius: 20px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.kz-letters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.kz-letter-pill {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 14px;
  padding: 8px 14px;
  font-size: 17px;
  font-weight: 900;
  color: var(--duo-text-dark);
  transition: all 0.12s ease;
}

.kz-letter-pill:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
}

.kz-letter-pill.active {
  background: #00afca;
  border-color: #008b9e;
  color: #ffffff;
}

.kz-letter-detail-box {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px 16px;
}

.kz-letter-hero {
  background: #d4f6fc;
  color: #007d91;
  border-radius: 14px;
  padding: 8px 14px;
  font-size: 24px;
  font-weight: 900;
}

.kz-letter-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kz-ex-chip {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--duo-text-dark);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.kz-ex-chip:hover {
  background: #eef8ff;
  border-color: var(--duo-blue);
}

.daily-phrase-card {
  background: linear-gradient(145deg, #f0fdff 0%, #ffffff 100%);
  border-color: #bae6fd;
}

.shop-card .duo-btn {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.auth-avatar-chip {
  outline: none !important;
}

/* ==========================================================================
   8. SLEEK UNIFIED TETRIS CONSOLE + EMERALD THEME
   ========================================================================== */
.tetris-console {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
}

.tetris-console-top {
  background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
  color: #ffffff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tetris-console-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 900;
}

.tetris-best-chip {
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.tetris-hud-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tetris-hud-pill {
  background: rgba(15, 23, 42, 0.28);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}

.tetris-console .tetris-target-bar {
  border-radius: 0;
  background: #0f172a;
  padding: 10px 14px;
}

.tetris-console .tetris-arena {
  border-radius: 0 !important;
  border: none !important;
  height: 270px !important;
}

.tetris-console .tetris-platforms {
  padding: 12px;
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.tetris-console .tetris-platform-btn {
  border-color: #10b981;
  color: #065f46;
}
.tetris-console .tetris-platform-btn:hover:not(:disabled) {
  background: #ecfdf5;
}
.tetris-platform-btn.correct-reveal {
  background: #d1fae5 !important;
  border-color: #059669 !important;
  color: #065f46 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}

.tetris-case-focus {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tetris-case-focus .tetris-case-pill {
  background: #10b981;
  color: #ffffff;
  font-size: 15px;
  padding: 5px 14px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}
.tetris-case-q {
  font-size: 15px;
  font-weight: 900;
  color: #fef08a;
}

@media (max-width: 768px) {
  .tetris-console .tetris-arena {
    min-height: 220px !important;
    height: auto !important;
    padding: 14px 10px !important;
  }
  .tetris-console .tetris-platforms {
    grid-template-columns: repeat(2, 1fr);
    padding: 10px;
    gap: 8px;
  }
}


/* ==========================================================================
   8. SMART TUTOR CHATBOT & MOBILE UI POLISH
   ========================================================================== */
body:has(#lesson-screen.active) .kz-tutor-fab,
body:has(#lesson-screen.active) .kz-tutor-drawer {
  display: none !important;
}

.kz-tutor-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 140;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 10px;
  border: 2px solid #10b981;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%);
  color: #065f46;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25), 0 4px 0 #059669;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.kz-tutor-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.32), 0 5px 0 #059669;
}
.kz-tutor-fab:active {
  transform: translateY(2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.22), 0 2px 0 #059669;
}
.kz-tutor-fab-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kz-tutor-drawer {
  position: fixed;
  bottom: 84px;
  right: 22px;
  width: min(390px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 110px));
  z-index: 150;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(18px) scale(0.92);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1),
              visibility 0.24s ease;
}
.kz-tutor-drawer.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  pointer-events: auto;
}
.kz-tutor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  background: linear-gradient(135deg, #00afca 0%, #059669 100%);
  color: #ffffff;
}
.kz-tutor-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.kz-tutor-avatar-sm {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
}
.kz-tutor-title {
  font-weight: 800;
  font-size: 14.5px;
  line-height: 1.2;
}
.kz-tutor-subtitle {
  font-size: 11.5px;
  opacity: 0.94;
  font-weight: 600;
}
.kz-tutor-header-actions {
  display: flex;
  gap: 6px;
}
.kz-tutor-icon-btn {
  border: none;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition: background 0.15s ease;
}
.kz-tutor-icon-btn:hover {
  background: rgba(255, 255, 255, 0.36);
}

.kz-tutor-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 11px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.kz-tutor-input:focus {
  border-color: #10b981;
}

.kz-tutor-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.kz-tutor-chip {
  flex-shrink: 0;
  border: 1.5px solid #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.kz-tutor-chip:hover {
  background: #d1fae5;
}

.kz-tutor-messages {
  flex: 1;
  min-height: 220px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
}
.kz-tutor-msg {
  display: flex;
}
.kz-tutor-msg.user {
  justify-content: flex-end;
}
.kz-tutor-msg.bot {
  justify-content: flex-start;
}
.kz-tutor-bubble {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #1e293b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  word-break: break-word;
}
.kz-tutor-msg.user .kz-tutor-bubble {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
  font-weight: 600;
}
.kz-tutor-speak-btn {
  display: inline-block;
  margin-top: 6px;
  margin-left: 2px;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f766e;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.kz-tutor-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

@media (max-width: 768px) {
  /* Mobile Bottom Navigation Polish */
  .left-sidebar {
    height: 66px !important;
    border-radius: 18px 18px 0 0 !important;
    box-shadow: 0 -6px 22px rgba(15, 23, 42, 0.08) !important;
    padding: 4px 0 !important;
  }
  .nav-item {
    border-radius: 12px !important;
    padding: 6px 10px !important;
    min-width: 68px !important;
    justify-content: center !important;
  }
  .nav-item.active {
    background: #ecfdf5 !important;
    color: #059669 !important;
  }
  .view-container {
    padding: 12px 12px 90px !important;
  }
  .steppe-time-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
  }
  .steppe-time-pills {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .steppe-time-pill {
    flex: 1 1 auto;
    text-align: center;
    font-size: 11.5px !important;
    padding: 5px 8px !important;
  }
  .unit-section-block {
    border-radius: 18px !important;
    margin-bottom: 20px !important;
  }
  .unit-banner {
    border-radius: 16px !important;
  }

  /* Mobile Tutor FAB & Drawer */
  .kz-tutor-fab {
    bottom: 76px;
    right: 12px;
    padding: 7px 12px 7px 8px;
    font-size: 12.5px;
  }
  .kz-tutor-drawer {
    bottom: 74px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100vh - 140px);
    border-radius: 18px;
  }
}

/* Big-site AI Assistant UI: казахские акценты, кнопки действий, follow-up подсказки, 3 точки печати */
.kz-tutor-kz-pill {
  display: inline-block;
  padding: 0 5px;
  border-radius: 6px;
  background: #d1fae5;
  color: #065f46;
  font-weight: 800;
}
.kz-tutor-msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.kz-tutor-speak-btn {
  margin-top: 0;
  margin-left: 0;
}
.kz-tutor-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 4px;
}
.kz-tutor-followup-btn {
  border: 1.5px solid #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.kz-tutor-followup-btn:hover {
  background: #e0f2fe;
  transform: translateY(-1px);
}
.kz-tutor-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 11px 14px;
}
.kz-tutor-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  animation: kz-typing-bounce 1.1s infinite ease-in-out;
}
.kz-tutor-typing span:nth-child(2) { animation-delay: 0.18s; }
.kz-tutor-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes kz-typing-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.45; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* ==========================================================================
   9. БЖБ / ТЖБ (СОР/СОЧ) НОВЫЕ ИНТЕРАКТИВНЫЕ ФОРМАТЫ ЗАДАНИЙ
   ========================================================================== */
.sor-write-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.sor-write-input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 800;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  outline: none;
  font-family: inherit;
  color: #0f172a;
  background: #f8fafc;
}
.sor-write-input:focus {
  border-color: #10b981;
  background: #ffffff;
}
.sor-kz-kbd {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sor-kz-key {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 2px solid #cbd5e1;
  border-bottom-width: 4px;
  border-radius: 10px;
  background: #ffffff;
  font-weight: 900;
  font-size: 15px;
  color: #0f766e;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.sor-kz-key:active {
  transform: translateY(2px);
}

.sor-order-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.sor-order-slots {
  min-height: 54px;
  padding: 10px 12px;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sor-order-placeholder {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
}
.sor-order-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sor-word-chip {
  padding: 8px 14px;
  border: 2px solid #cbd5e1;
  border-bottom-width: 4px;
  border-radius: 12px;
  background: #ffffff;
  font-weight: 800;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
}
.sor-word-chip.placed {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}
.sor-word-chip.used {
  opacity: 0.35;
  cursor: default;
}

.sor-match-wrap {
  margin-bottom: 18px;
}
.sor-match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sor-match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sor-match-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-bottom-width: 4px;
  border-radius: 12px;
  background: #ffffff;
  font-weight: 800;
  font-size: 13.5px;
  color: #1e293b;
  cursor: pointer;
}
.sor-match-btn.selected {
  border-color: #3b82f6;
  background: #eff6ff;
}
.sor-match-btn.paired {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
}
.sor-match-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sor-audio-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

/* БЖБ / ТЖБ прогресс-бар и фирменное оформление QazaqLearn */
.sor-progress-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}
.sor-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00afca 0%, #10b981 100%);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.sor-exam-card {
  border-top: 4px solid #00afca !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08) !important;
}
.sor-sec-badge {
  background: linear-gradient(135deg, #ecfdf5 0%, #cffafe 100%) !important;
  color: #0f766e !important;
  border: 1px solid #99f6e4 !important;
}
.left-sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.sidebar-card {
  border-radius: 20px !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

/* ==========================================================================
   10. ОБОИ И ЦЕНТРАЛЬНАЯ КАРТОЧКА ВО ВРЕМЯ УРОКОВ (НЕ ПУСТО ПО БОКАМ)
   ========================================================================== */
.lesson-screen {
  background-color: #ecfeff;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%2300afca' stroke-width='1.5' stroke-opacity='0.14'%3E%3Cpath d='M48 10 C38 10 34 20 42 26 C32 28 28 38 38 42 C28 46 32 56 42 58 C34 64 38 74 48 74 C58 74 62 64 54 58 C64 56 68 46 58 42 C68 38 64 28 54 26 C62 20 58 10 48 10 Z'/%3E%3Ccircle cx='48' cy='42' r='4' fill='%2300afca' fill-opacity='0.1'/%3E%3Cpath d='M8 8 L20 20 M88 8 L76 20 M8 88 L20 76 M88 88 L76 76'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #e0f2fe 0%, #ecfdf5 52%, #cffafe 100%);
  background-size: 96px 96px, 100% 100%;
}
.lesson-screen[data-unit-theme="2"] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23d97706' stroke-width='1.5' stroke-opacity='0.15'%3E%3Cpath d='M48 10 C38 10 34 20 42 26 C32 28 28 38 38 42 C28 46 32 56 42 58 C34 64 38 74 48 74 C58 74 62 64 54 58 C64 56 68 46 58 42 C68 38 64 28 54 26 C62 20 58 10 48 10 Z'/%3E%3Ccircle cx='48' cy='42' r='4' fill='%23d97706' fill-opacity='0.1'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #fffbeb 0%, #fef3c7 50%, #ffedd5 100%);
}
.lesson-screen[data-unit-theme="3"] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23059669' stroke-width='1.5' stroke-opacity='0.15'%3E%3Cpath d='M48 10 C38 10 34 20 42 26 C32 28 28 38 38 42 C28 46 32 56 42 58 C34 64 38 74 48 74 C58 74 62 64 54 58 C64 56 68 46 58 42 C68 38 64 28 54 26 C62 20 58 10 48 10 Z'/%3E%3Ccircle cx='48' cy='42' r='4' fill='%23059669' fill-opacity='0.1'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #e0f2fe 100%);
}
.lesson-screen[data-unit-theme="4"] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%230d9488' stroke-width='1.5' stroke-opacity='0.16'%3E%3Cpath d='M48 10 C38 10 34 20 42 26 C32 28 28 38 38 42 C28 46 32 56 42 58 C34 64 38 74 48 74 C58 74 62 64 54 58 C64 56 68 46 58 42 C68 38 64 28 54 26 C62 20 58 10 48 10 Z'/%3E%3Ccircle cx='48' cy='42' r='4' fill='%230d9488' fill-opacity='0.1'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #fefce8 0%, #ffedd5 50%, #ccfbf1 100%);
}
.lesson-screen[data-unit-theme="5"] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%234f46e5' stroke-width='1.5' stroke-opacity='0.14'%3E%3Cpath d='M48 10 C38 10 34 20 42 26 C32 28 28 38 38 42 C28 46 32 56 42 58 C34 64 38 74 48 74 C58 74 62 64 54 58 C64 56 68 46 58 42 C68 38 64 28 54 26 C62 20 58 10 48 10 Z'/%3E%3Ccircle cx='48' cy='42' r='4' fill='%234f46e5' fill-opacity='0.1'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #eef2ff 0%, #e0e7ff 50%, #dbeafe 100%);
}
.lesson-header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(203, 213, 225, 0.65);
}
@media (min-width: 769px) {
  .lesson-body {
    background: rgba(255, 255, 255, 0.96);
    border: 2px solid rgba(203, 213, 225, 0.8);
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
    margin: 22px auto 114px;
    padding: 32px 38px;
    max-width: 720px;
    flex: 0 1 auto;
  }
}

/* ====================================================================
   BARYS STREAK CELEBRATION (DUOLINGO-STYLE RUN-THROUGH)
   ==================================================================== */
.lesson-body {
  transition: opacity 0.25s ease, transform 0.28s ease;
}

.lesson-body.is-streak-paused {
  opacity: 0.16;
  transform: scale(0.96);
  pointer-events: none;
}

.lesson-streak-overlay {
  position: absolute;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 52%, rgba(34, 211, 238, 0.18), rgba(255, 255, 255, 0.55) 60%, transparent 100%);
  animation: barysOverlayFade 1.95s ease forwards;
}

.barys-streak-stage {
  position: relative;
  width: 100%;
  max-width: 680px;
  height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 24px;
}

.barys-streak-bubble {
  position: relative;
  background: #ffffff;
  border: 2.5px solid #22d3ee;
  border-radius: 22px;
  padding: 14px 22px;
  margin-bottom: 18px;
  box-shadow: 0 14px 32px rgba(8, 145, 178, 0.2);
  text-align: center;
  max-width: min(340px, 86vw);
  opacity: 0;
  transform: scale(0.5) translateY(20px);
  animation: barysBubblePop 1.95s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.barys-streak-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-right: 2.5px solid #22d3ee;
  border-bottom: 2.5px solid #22d3ee;
}

.barys-streak-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f97316, #f59e0b);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
  box-shadow: 0 3px 0 #c2410c;
}

.barys-streak-text {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

.barys-streak-runner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform, opacity;
  animation: barysRunAcross 1.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.barys-mascot-wrap {
  filter: drop-shadow(0 12px 18px rgba(8, 145, 178, 0.25));
  animation: barysStepBounce 0.34s ease-in-out infinite alternate;
}

.barys-speed-trail {
  position: absolute;
  left: -58px;
  top: 54%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  animation: barysTrailShow 1.95s ease forwards;
}

.barys-speed-trail span {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #22d3ee);
}

.barys-speed-trail span:nth-child(1) { width: 42px; }
.barys-speed-trail span:nth-child(2) { width: 56px; margin-left: -10px; background: linear-gradient(90deg, transparent, #fbbf24); }
.barys-speed-trail span:nth-child(3) { width: 34px; }

@keyframes barysOverlayFade {
  0% { opacity: 0; }
  12% { opacity: 1; }
  84% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes barysRunAcross {
  0% {
    transform: translateX(-70vw) rotate(8deg) scale(0.92);
    opacity: 0.4;
  }
  24% {
    transform: translateX(0) rotate(-3deg) scale(1.06);
    opacity: 1;
  }
  32% {
    transform: translateX(0) rotate(0deg) scale(1.04);
    opacity: 1;
  }
  72% {
    transform: translateX(0) rotate(0deg) scale(1.04);
    opacity: 1;
  }
  80% {
    transform: translateX(-14px) rotate(-6deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(72vw) rotate(10deg) scale(0.94);
    opacity: 0.2;
  }
}

@keyframes barysStepBounce {
  0% { transform: translateY(0px) scaleY(1); }
  100% { transform: translateY(-10px) scaleY(1.03); }
}

@keyframes barysBubblePop {
  0%, 20% {
    opacity: 0;
    transform: scale(0.4) translateY(22px);
  }
  32% {
    opacity: 1;
    transform: scale(1.06) translateY(-2px);
  }
  40%, 70% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  82%, 100% {
    opacity: 0;
    transform: scale(0.75) translateY(-12px);
  }
}

@keyframes barysTrailShow {
  0% { opacity: 0.9; }
  24% { opacity: 0.9; }
  30%, 74% { opacity: 0; }
  82% { opacity: 0.95; }
  100% { opacity: 0; }
}

/* ====================================================================
   MODERN TEXTBOOK MODAL & EMBEDDED READER
   ==================================================================== */
.modal-window-modern {
  max-width: 980px;
  max-height: 92vh;
  border-radius: 26px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 28px 64px rgba(15, 23, 42, 0.24);
  background: #ffffff;
}

.modal-header-modern {
  padding: 18px 26px;
  background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.modal-title-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #06b6d4, #0284c7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 6px 14px rgba(2, 132, 199, 0.25);
}

.modal-subtitle {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin-top: 2px;
}

.modal-close-modern {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.modal-close-modern:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.tb-nav-modern {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  margin: 14px 24px 0;
  padding: 5px;
  background: #f1f5f9;
  border-radius: 16px;
  border-bottom: none;
}

.tb-nav-modern .tb-tab-btn {
  border-bottom: none;
  border-radius: 12px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.tb-nav-modern .tb-tab-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.tb-nav-modern .tb-tab-btn.active {
  background: #ffffff;
  color: #0284c7;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.modal-scroll-modern {
  padding: 18px 24px 24px;
}

.pdf-reader-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pdf-reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid #dbeafe;
}

.pdf-reader-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pdf-reader-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.08);
}

.pdf-reader-title {
  font-size: 15px;
  font-weight: 900;
  color: #0f172a;
}

.pdf-reader-sub {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.pdf-fullscreen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 12px;
  background: #0f172a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.pdf-fullscreen-btn:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

.pdf-reader-frame {
  width: 100%;
  height: min(67vh, 620px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #0f172a;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

.pdf-reader-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ====================================================================
   COMPREHENSIVE MOBILE FIXES (<= 768px)
   ==================================================================== */
@media (max-width: 768px) {
  .content-body {
    padding: 14px 12px 126px !important;
  }

  /* Bottom navigation: compact tabs with peek of 5th tab */
  .nav-item {
    min-width: 60px !important;
    padding: 6px 5px !important;
  }
  .nav-links {
    padding: 0 18px 0 6px !important;
    gap: 2px !important;
  }

  /* Compact circular Tutor FAB so it doesn't cover buttons/cards */
  .kz-tutor-fab {
    width: 50px !important;
    height: 50px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
    bottom: 74px !important;
    right: 12px !important;
    box-shadow: 0 8px 20px rgba(8, 145, 178, 0.35) !important;
  }
  .kz-tutor-fab-label {
    display: none !important;
  }
  body:has(.modal-overlay.active) .kz-tutor-fab,
  body:has(#view-games.active) .kz-tutor-fab {
    display: none !important;
  }

  /* Welcome & Auth screens fit 390px cleanly */
  .welcome-pane,
  .welcome-pane.active {
    padding: 16px 12px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  .welcome-content-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px 16px !important;
    box-sizing: border-box !important;
  }
  .welcome-content-card .duo-btn {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Modern Textbook Modal on mobile */
  .modal-window.modal-window-modern {
    width: calc(100% - 12px) !important;
    max-width: none !important;
    height: 90vh !important;
    max-height: 90vh !important;
    border-radius: 20px !important;
    margin: 0 auto !important;
  }
  .modal-header-modern {
    padding: 12px 14px !important;
  }
  .tb-nav-modern {
    margin: 10px 12px 0 !important;
    padding: 4px !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    flex-shrink: 0 !important;
  }
  .tb-nav-modern .tb-tab-btn {
    height: auto !important;
    min-height: 36px !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
  }
  .modal-scroll-modern {
    padding: 12px !important;
  }
  .pdf-reader-toolbar {
    padding: 10px 12px !important;
    gap: 8px !important;
  }
  .pdf-reader-title {
    font-size: 13px !important;
  }
  .pdf-reader-sub {
    font-size: 11px !important;
  }
  .pdf-fullscreen-btn {
    padding: 7px 12px !important;
    font-size: 12px !important;
    width: 100%;
    justify-content: center;
  }
  .pdf-reader-frame {
    height: 52vh !important;
    min-height: 310px !important;
    border-radius: 14px !important;
  }

  /* Case Tetris Console compact mobile layout (fits without overlap) */
  .tetris-console {
    border-radius: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  .tetris-console-top {
    padding: 10px 12px !important;
    gap: 8px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  .tetris-hud-pills {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .games-mode-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .games-mode-card {
    padding: 10px !important;
    gap: 8px !important;
  }
  .games-mode-meta strong { font-size: 13px !important; }
  .games-mode-meta small { font-size: 11px !important; }
  .tetris-console .tetris-arena {
    height: 180px !important;
    min-height: 180px !important;
    padding: 8px !important;
  }
  .tetris-word-block {
    font-size: 17px !important;
    padding: 7px 14px !important;
    max-width: calc(100% - 20px) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .tetris-console .tetris-platforms {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 10px !important;
  }
  .tetris-console-title {
    font-size: 14px !important;
    gap: 6px !important;
  }
  .tetris-hud-pill {
    padding: 3px 8px !important;
    font-size: 11.5px !important;
  }
  .tetris-console .tetris-target-bar {
    padding: 8px 10px !important;
  }
  .tetris-case-focus {
    gap: 6px !important;
  }
  .tetris-case-focus .tetris-case-pill {
    font-size: 12.5px !important;
    padding: 4px 10px !important;
  }
  .tetris-case-q {
    font-size: 12.5px !important;
  }
  .tetris-console .tetris-arena {
    height: 175px !important;
    min-height: 175px !important;
    padding: 8px !important;
  }
  .tetris-word-block {
    font-size: 18px !important;
    padding: 8px 16px !important;
  }
  .tetris-console .tetris-platforms {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    padding: 10px !important;
  }
  .tetris-console .tetris-platform-btn {
    padding: 10px 8px !important;
    font-size: 15px !important;
    min-height: 46px !important;
  }

  /* Declension tool mobile: horizontal chips + readable 7-case table */
  .preset-chips-scroll,
  .quick-words-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 6px !important;
    padding-bottom: 6px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
  }
  .preset-chips-scroll::-webkit-scrollbar,
  .quick-words-grid::-webkit-scrollbar {
    display: none !important;
  }
  .preset-chips-scroll > *,
  .quick-word-chip {
    flex-shrink: 0 !important;
  }
  .cases-header-row > *:nth-child(2),
  .case-row-item > *:nth-child(2) {
    display: none !important;
  }
  .cases-header-row,
  .case-row-item {
    grid-template-columns: 1.15fr 1.45fr 38px !important;
    gap: 8px !important;
    padding: 10px 10px !important;
    font-size: 13px !important;
    align-items: center !important;
  }
  .case-result-cell {
    word-break: normal !important;
    overflow-wrap: anywhere;
    font-size: 14px !important;
  }

  /* League pills: wrap cleanly, no grey scrollbar */
  #league-divisions-bar,
  .league-actions-wrap {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    gap: 8px !important;
    scrollbar-width: none !important;
  }
  #league-divisions-bar::-webkit-scrollbar,
  .league-actions-wrap::-webkit-scrollbar {
    display: none !important;
  }
  .league-div-pill {
    flex: 1 1 auto !important;
    justify-content: center !important;
    padding: 8px 10px !important;
    font-size: 12.5px !important;
    white-space: nowrap !important;
  }

  /* Shop cards: stack button below text so text is never squeezed */
  .shop-card {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .shop-card .duo-btn {
    width: 100% !important;
  }

  /* Lesson screen mobile spacing */
  .lesson-body {
    padding: 16px 14px 100px !important;
  }
  .lesson-footer-drawer:not(.correct):not(.wrong) .feedback-left {
    display: none !important;
  }
  .lesson-footer-drawer:not(.correct):not(.wrong) {
    padding: 12px 16px !important;
  }
}

/* ====================================================================
   MODERN SHOP SHOWCASE & TEXTBOOK SEARCH TOOLBAR
   ==================================================================== */
.textbook-card-modern {
  background: linear-gradient(160deg, #ffffff 0%, #f0f9ff 100%);
  border: 1.5px solid #bae6fd;
}

.textbook-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tb-vocab-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.tb-vocab-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tb-vocab-search {
  padding: 8px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  outline: none;
  min-width: 180px;
  background: #f8fafc;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.tb-vocab-search:focus {
  border-color: #0284c7;
  background: #ffffff;
}

.shop-hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #0284c7 100%);
  color: #ffffff;
  border-radius: 22px;
  padding: 22px 24px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 14px 32px rgba(2, 132, 199, 0.22);
}

.shop-hero-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.shop-hero-left h3 {
  font-size: 22px;
  font-weight: 900;
  margin: 0 0 4px;
}

.shop-hero-left p {
  font-size: 13px;
  color: #cbd5e1;
  margin: 0;
}

.shop-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
}

.shop-wallet-pill.active {
  background: rgba(250, 204, 21, 0.22);
  border-color: #fde047;
  color: #fef08a;
}

#shop-items-grid.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.shop-card.shop-card-modern {
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.shop-card.shop-card-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.09);
}

.shop-card.shop-card-modern.is-equipped {
  border-color: #10b981;
  background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
}

.shop-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.shop-cat-pill {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}

.shop-accent-ice .shop-cat-pill { background: #e0f2fe; color: #0369a1; }
.shop-accent-gold .shop-cat-pill { background: #fef3c7; color: #b45309; }
.shop-accent-rose .shop-cat-pill { background: #ffe4e6; color: #be123c; }
.shop-accent-violet .shop-cat-pill { background: #f3e8ff; color: #7e22ce; }
.shop-accent-emerald .shop-cat-pill { background: #d1fae5; color: #047857; }

.shop-owned-pill {
  font-size: 11px;
  font-weight: 800;
  color: #059669;
  background: #d1fae5;
  padding: 3px 8px;
  border-radius: 999px;
}

.shop-card-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  #shop-items-grid.shop-grid {
    grid-template-columns: 1fr !important;
  }
  .shop-hero-banner {
    padding: 16px !important;
  }
  .tb-vocab-search {
    width: 100% !important;
  }
}

/* ====================================================================
   DUOLINGO MINIMALIST ICON-ONLY MOBILE NAV + DISTINCT SUNSET THEME
   ==================================================================== */
.duo-nav-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.duo-nav-svg svg {
  display: block;
}

#learning-path-container[data-steppe-time="day"] .kz-scenery-backdrop-svg {
  background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 65%, #f0f9ff 100%);
}

#learning-path-container[data-steppe-time="sunset"] .kz-scenery-backdrop-svg {
  background: linear-gradient(180deg, #fb7185 0%, #fb923c 46%, #fde68a 100%);
}

#learning-path-container[data-steppe-time="sunset"] .unit-section-wrapper {
  background: linear-gradient(180deg, rgba(254, 215, 170, 0.28) 0%, rgba(255, 237, 213, 0.14) 100%);
}

#learning-path-container[data-steppe-time="night"] .kz-scenery-backdrop-svg {
  background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 68%, #312e81 100%);
}

@media (max-width: 768px) {
  .left-sidebar {
    height: 60px !important;
    border-top: 1px solid #e5e5e5 !important;
    background: #ffffff !important;
  }
  .nav-links {
    padding: 0 8px !important;
    gap: 6px !important;
    align-items: center !important;
    height: 100% !important;
  }
  .nav-item {
    min-width: 46px !important;
    width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 14px !important;
    background: transparent !important;
    justify-content: center !important;
    align-items: center !important;
    box-shadow: none !important;
    transition: transform 0.15s ease, background 0.15s ease;
  }
  .nav-item span:not(.nav-icon) {
    display: none !important;
  }
  .nav-item.active {
    background: rgba(28, 176, 246, 0.14) !important;
    border: none !important;
    box-shadow: none !important;
    transform: scale(1.08);
  }
  .nav-item:not(.active) .duo-nav-svg {
    opacity: 0.78;
  }
  .path-mascot-companion {
    left: -64px !important;
    top: -10px !important;
    transform: scale(0.68) !important;
  }
}

/* ====================================================================
   FAST LIGHTWEIGHT PAGE-BY-PAGE TEXTBOOK READER (ZERO IFRAME LAG)
   ==================================================================== */
.fast-reader-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
}

.fast-reader-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fast-reader-page-box {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 4px 10px;
}

.fast-reader-page-box input {
  width: 48px;
  border: none;
  outline: none;
  text-align: center;
  font-weight: 900;
  font-size: 14px;
  color: #0284c7;
  background: transparent;
}

.fast-reader-bookmarks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fast-bookmark-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fast-bookmark-pill:hover,
.fast-bookmark-pill.active {
  border-color: #0284c7;
  background: #e0f2fe;
  color: #0369a1;
}

.fast-reader-canvas {
  width: 100%;
  min-height: 0;
  max-height: calc(100dvh - 335px);
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px;
}

.fast-reader-canvas img {
  max-width: 100%;
  max-height: calc(100dvh - 350px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
  display: block;
  transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

#modal-textbook .modal-window-modern {
  max-width: 1060px;
  width: 96vw;
  max-height: 95dvh;
}

#modal-textbook .modal-scroll-modern {
  padding: 10px 16px;
  overflow: hidden;
}

@media (min-width: 769px) {
  .pdf-reader-shell {
    display: grid;
    grid-template-columns: 270px 1fr;
    grid-template-rows: auto 1fr;
    gap: 12px;
    align-items: start;
  }
  .pdf-reader-shell .pdf-reader-toolbar {
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  .pdf-reader-shell .fast-reader-controls {
    grid-column: 1;
    grid-row: 2;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .pdf-reader-shell .fast-reader-nav {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
  }
  .pdf-reader-shell .fast-reader-bookmarks {
    flex-direction: column;
    align-items: stretch;
  }
  .pdf-reader-shell .fast-reader-canvas {
    grid-column: 2;
    grid-row: 1 / span 2;
    height: calc(92dvh - 115px);
    max-height: calc(92dvh - 115px);
    padding: 8px;
  }
  .pdf-reader-shell .fast-reader-canvas img {
    max-height: calc(92dvh - 135px);
  }
}

@media (max-width: 768px) {
  .fast-reader-canvas {
    max-height: calc(100dvh - 280px);
    padding: 4px;
  }
  .fast-reader-canvas img {
    max-height: calc(100dvh - 292px);
  }
}

.fast-reader-canvas img.is-turning.turn-next {
  opacity: 0.35;
  transform: translateX(-16px) scale(0.985);
}

.fast-reader-canvas img.is-turning.turn-prev {
  opacity: 0.35;
  transform: translateX(16px) scale(0.985);
}

/* ==========================================================================
   TEACHER PANEL & STUDENT DIARY (v119.0)
   ========================================================================== */
.teacher-hero-banner {
  background: linear-gradient(135deg, #16a34a 0%, #0ea5e9 100%);
  color: #ffffff;
  border-radius: 22px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: 0 10px 26px rgba(14, 165, 233, 0.22);
  margin-bottom: 18px;
}
.teacher-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.22);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.teacher-hero-banner h2 {
  font-size: 26px;
  font-weight: 900;
  margin: 0 0 6px;
}
.teacher-hero-banner p {
  margin: 0;
  font-size: 14px;
  opacity: 0.94;
}
.teacher-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 10px;
}
.teacher-stat-pill {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.teacher-stat-pill span { font-size: 20px; }
.teacher-stat-pill strong { display: block; font-size: 18px; line-height: 1.1; }
.teacher-stat-pill small { font-size: 11px; opacity: 0.9; }

.teacher-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.teacher-tab-btn {
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  background: #ffffff;
  color: var(--duo-text-dark);
  font-weight: 800;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}
.teacher-tab-btn.active {
  background: #e0f2fe;
  border-color: #1cb0f6;
  color: #0369a1;
}

.teacher-two-col {
  display: grid;
  grid-template-columns: minmax(440px, 1.38fr) minmax(320px, 0.95fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 960px) {
  .teacher-two-col { grid-template-columns: 1fr; }
}

@media (min-width: 1024px) {
  .teacher-form-card {
    padding: 24px 26px;
    position: sticky;
    top: 84px;
  }
  .teacher-form-card h3 {
    font-size: 20px;
  }
}

.teacher-form-card,
.teacher-item-card,
.teacher-student-card,
.teacher-denied-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 20px;
  padding: 18px;
}
.teacher-denied-card {
  max-width: 460px;
  margin: 40px auto;
  text-align: center;
}
.teacher-form-card h3,
.teacher-list-col h3 {
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 12px;
}
.teacher-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  margin: 10px 0 4px;
  text-transform: uppercase;
}
.teacher-input {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid var(--duo-gray-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  background: #f8fafc;
  color: var(--duo-text-dark);
}
.teacher-input:focus {
  outline: none;
  border-color: #1cb0f6;
  background: #ffffff;
}
.teacher-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 520px) {
  .teacher-form-row { grid-template-columns: 1fr; }
}

.teacher-score-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.teacher-score-btn {
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 3px;
  border-radius: 12px;
  padding: 8px 0;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  background: #ffffff;
  font-family: inherit;
}
.teacher-score-btn.active {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.35);
  border-color: #0284c7;
}
.teacher-score-btn.grade-high.active { background: #dcfce7; color: #15803d; border-color: #22c55e; }
.teacher-score-btn.grade-mid.active { background: #fef9c3; color: #a16207; border-color: #eab308; }
.teacher-score-btn.grade-low.active { background: #fee2e2; color: #b91c1c; border-color: #ef4444; }

.teacher-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.teacher-chip-btn {
  border: 1.5px solid var(--duo-gray-border);
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}
.teacher-chip-btn:hover { background: #e0f2fe; border-color: #38bdf8; }
.teacher-chip-btn.submitted { background: #dcfce7; border-color: #22c55e; color: #15803d; }

.teacher-list-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.teacher-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.teacher-item-head h4 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 900;
}
.teacher-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.teacher-meta-chip {
  background: #f1f5f9;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}
.teacher-meta-chip.lesson { background: #e0f2fe; color: #0369a1; }
.teacher-meta-chip.done { background: #dcfce7; color: #15803d; }
.teacher-item-desc {
  margin: 10px 0 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
}
.teacher-done-names {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #15803d;
}
.teacher-del-btn {
  border: none;
  background: #fee2e2;
  color: #b91c1c;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}

.teacher-grade-row {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.teacher-grade-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
}
.teacher-grade-badge.grade-high { background: #dcfce7; color: #15803d; border: 2px solid #86efac; }
.teacher-grade-badge.grade-mid { background: #fef9c3; color: #a16207; border: 2px solid #fde047; }
.teacher-grade-badge.grade-low { background: #fee2e2; color: #b91c1c; border: 2px solid #fca5a5; }
.teacher-grade-info { flex: 1; min-width: 0; }
.teacher-grade-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.teacher-grade-date { font-size: 11px; font-weight: 700; color: var(--duo-gray-dark); }
.teacher-grade-comment { font-size: 13px; color: #475569; margin-top: 4px; }

.teacher-students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.teacher-student-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.teacher-student-name { font-size: 16px; font-weight: 900; }
.teacher-student-sub { font-size: 12px; color: var(--duo-gray-dark); font-weight: 700; }
.teacher-avg-pill {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 900;
  font-size: 15px;
  padding: 5px 10px;
  border-radius: 12px;
}
.teacher-student-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 12px;
}
.teacher-student-actions {
  display: flex;
  gap: 8px;
}
.teacher-empty {
  background: #f8fafc;
  border: 2px dashed var(--duo-gray-border);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  color: var(--duo-gray-dark);
  font-weight: 700;
}

.student-diary-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.student-announce-banner {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #f59e0b;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #78350f;
}
.student-diary-block h3 {
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 10px;
}
.student-hw-list,
.student-grades-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.student-hw-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.student-hw-card.done {
  background: #f0fdf4;
  border-color: #86efac;
}
.student-hw-title { font-size: 16px; font-weight: 900; margin-bottom: 4px; }
.student-hw-desc { font-size: 13px; color: #475569; margin-bottom: 6px; }
.student-hw-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; font-weight: 700; color: var(--duo-gray-dark); }
.student-hw-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.nav-notice-badge {
  position: absolute;
  top: -5px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff4b4b;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(255, 75, 75, 0.35);
}

.notices-hero-banner {
  background: linear-gradient(135deg, #f59e0b 0%, #fb7185 100%);
  color: #ffffff;
  border-radius: 22px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: 0 10px 26px rgba(245, 158, 11, 0.24);
  margin-bottom: 18px;
}
.notices-hero-banner h2 {
  font-size: 26px;
  font-weight: 900;
  margin: 0 0 6px;
}
.notices-hero-banner p {
  margin: 0;
  font-size: 14px;
  opacity: 0.95;
}

.teacher-hero-banner {
  background: linear-gradient(135deg, #10b981 0%, #0284c7 100%);
  border: 2px solid rgba(255, 255, 255, 0.25);
}
.teacher-tab-btn:hover {
  border-color: #38bdf8;
  transform: translateY(-1px);
}
.teacher-tab-btn.active {
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
  border-color: #0284c7;
  color: #0369a1;
}
.teacher-form-card,
.teacher-item-card,
.teacher-student-card {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

/* ==========================================================================
   FLASHCARDS GAME (v120.0)
   ========================================================================== */
.flashcards-lobby-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 22px;
  padding: 22px;
}
.flashcards-lobby-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.flashcards-lobby-head h2 { margin: 4px 0 4px; font-size: 22px; font-weight: 900; }
.flashcards-lobby-head p { margin: 0; font-size: 13px; color: var(--duo-gray-dark); }

.flashcards-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.flashcards-unit-btn {
  text-align: left;
  background: #f8fafc;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 18px;
  padding: 16px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.flashcards-unit-btn:hover {
  transform: translateY(-2px);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.flashcards-unit-top { display: flex; justify-content: space-between; align-items: center; }
.flashcards-unit-icon { font-size: 28px; }
.flashcards-unit-count {
  font-size: 11px;
  font-weight: 900;
  background: #e2e8f0;
  color: #334155;
  padding: 3px 9px;
  border-radius: 999px;
}
.flashcards-unit-title { font-size: 16px; font-weight: 900; color: var(--duo-text-dark); }
.flashcards-unit-sub { font-size: 12px; color: var(--duo-gray-dark); line-height: 1.35; flex: 1; }
.flashcards-unit-cta { font-size: 12px; font-weight: 900; color: #059669; margin-top: 4px; }

.flashcard-stage-wrap {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.flashcard-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.flashcard-unit-pill {
  background: #ecfdf5;
  color: #047857;
  border: 2px solid #a7f3d0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 900;
}
.flashcard-progress-row { display: flex; align-items: center; gap: 12px; }
.flashcard-counter { font-size: 13px; font-weight: 900; color: var(--duo-gray-dark); white-space: nowrap; }

.flashcard-scene {
  perspective: 1200px;
  cursor: pointer;
  user-select: none;
}
.flashcard-3d-inner {
  position: relative;
  width: 100%;
  min-height: 310px;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.flashcard-3d-inner.is-flipped {
  transform: rotateY(180deg);
}
.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 24px;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 6px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}
.flashcard-front {
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
  border-color: #86efac;
}
.flashcard-back {
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  border-color: #93c5fd;
  transform: rotateY(180deg);
}
.flashcard-face-tag {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--duo-gray-dark);
  background: rgba(15, 23, 42, 0.06);
  padding: 4px 12px;
  border-radius: 999px;
}
.flashcard-word-kz {
  font-size: 36px;
  font-weight: 900;
  color: var(--duo-text-dark);
  line-height: 1.15;
}
.flashcard-word-kz.small {
  font-size: 22px;
  color: #1d4ed8;
}
.flashcard-word-ru {
  font-size: 28px;
  font-weight: 900;
  color: #0f172a;
}
.flashcard-speak-btn {
  border: 2px solid #bae6fd;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
}
.flashcard-example-box {
  width: 100%;
  background: #ffffff;
  border: 2px solid #bfdbfe;
  border-radius: 16px;
  padding: 12px 14px;
  margin-top: 4px;
}
.flashcard-example-lbl {
  font-size: 11px;
  font-weight: 900;
  color: #2563eb;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.flashcard-example-text {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
}
.flashcard-tap-hint {
  font-size: 12px;
  font-weight: 700;
  color: var(--duo-gray-dark);
  margin-top: 4px;
}
.flashcard-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   KUNDELIK QUARTER CALCULATOR & SCHEDULE (v123.0)
   ========================================================================== */
.teacher-cat-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.teacher-cat-pill {
  flex: 1;
  min-width: 90px;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 3px;
  border-radius: 12px;
  background: #ffffff;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
}
.teacher-cat-pill.active {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0369a1;
}

.kundelik-summary-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}
.kundelik-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.kundelik-summary-head h3 { margin: 4px 0 0; font-size: 20px; font-weight: 900; }
.kundelik-quarter-box {
  min-width: 145px;
  border-radius: 18px;
  padding: 10px 16px;
  text-align: center;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
}
.kundelik-quarter-box.high { background: #dcfce7; border-color: #22c55e; color: #15803d; }
.kundelik-quarter-box.mid { background: #fef9c3; border-color: #eab308; color: #a16207; }
.kundelik-quarter-box.low { background: #fee2e2; border-color: #ef4444; color: #b91c1c; }
.kundelik-quarter-box small { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.kundelik-quarter-box strong { display: block; font-size: 32px; line-height: 1.05; font-weight: 900; }
.kundelik-quarter-box span { font-size: 11px; font-weight: 800; }

.kundelik-weights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.kundelik-weight-tile {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 14px;
}
.kundelik-wt-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 4px;
}
.kundelik-wt-val {
  font-size: 15px;
  font-weight: 900;
  color: var(--duo-text-dark);
  margin-bottom: 8px;
}
.kundelik-mini-grade {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
}
.kundelik-mini-grade.high { background: #dcfce7; color: #15803d; }
.kundelik-mini-grade.mid { background: #fef9c3; color: #a16207; }
.kundelik-mini-grade.low { background: #fee2e2; color: #b91c1c; }

.schedule-week-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 10px;
}
@media (max-width: 720px) {
  .schedule-week-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.schedule-day-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.schedule-day-card.has-lesson {
  background: #f0fdf4;
  border-color: #86efac;
}
.schedule-day-card.no-lesson {
  background: #f8fafc;
  opacity: 0.85;
}
.schedule-day-card.is-today {
  box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.32);
  border-color: #0ea5e9;
}
.schedule-day-top { display: flex; justify-content: space-between; align-items: center; }
.schedule-day-name { font-size: 16px; font-weight: 900; color: var(--duo-text-dark); }
.schedule-today-pill {
  font-size: 10px;
  font-weight: 900;
  background: #0ea5e9;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 999px;
}
.schedule-day-full { font-size: 11px; font-weight: 700; color: var(--duo-gray-dark); }
.schedule-day-lesson { font-size: 13px; font-weight: 900; color: #0f172a; margin-top: 4px; }

/* ==========================================================================
   DARK THEME (v125.0)
   ========================================================================== */
body.dark-theme {
  --duo-gray-bg: #131f24;
  --duo-gray-panel: #1b2a32;
  --duo-gray-border: #2b3f4a;
  --duo-gray-border-dark: #22333c;
  --duo-gray-text: #9fb3bd;
  --duo-gray-dark: #b6c8d1;
  --duo-text-dark: #f1f5f9;
  background-color: #131f24 !important;
  color: #f1f5f9 !important;
}

body.dark-theme .sidebar,
body.dark-theme .left-sidebar,
body.dark-theme .right-sidebar,
body.dark-theme .top-header {
  background: #16232a !important;
  background-color: #16232a !important;
  border-color: #2b3f4a !important;
}

body.dark-theme .sidebar-card,
body.dark-theme .tetris-console,
body.dark-theme .tetris-console-top,
body.dark-theme .tetris-console .tetris-arena,
body.dark-theme .tetris-arena,
body.dark-theme .tetris-console .tetris-start-overlay,
body.dark-theme .tetris-start-overlay,
body.dark-theme .tetris-console .tetris-platforms,
body.dark-theme .tetris-console .tetris-platform-btn,
body.dark-theme .tetris-hud-pill,
body.dark-theme .tetris-best-chip,
body.dark-theme .tetris-target-bar {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .tetris-console .tetris-target-bar {
  background: #0f172a !important;
}

body.dark-theme .tetris-console .tetris-platform-btn:hover:not(:disabled) {
  background: #233843 !important;
  border-color: #10b981 !important;
}

body.dark-theme .tetris-start-overlay h3,
body.dark-theme .tetris-start-overlay p,
body.dark-theme .sidebar-card h3,
body.dark-theme .sidebar-card p,
body.dark-theme .quest-desc {
  color: #e2e8f0 !important;
}

body.dark-theme .nav-item:hover {
  background-color: #1f313a !important;
}

body.dark-theme .nav-item.active {
  background-color: rgba(28, 176, 246, 0.16) !important;
  border-color: #1cb0f6 !important;
}

body.dark-theme .course-selector,
body.dark-theme .sound-toggle-btn,
body.dark-theme .choice-card,
body.dark-theme .dictionary-card,
body.dark-theme .shop-card,
body.dark-theme .leaderboard-row,
body.dark-theme .duo-profile-course-card,
body.dark-theme .duo-frame-card,
body.dark-theme .duo-banner-card,
body.dark-theme .passport-stamp-card,
body.dark-theme .teacher-form-card,
body.dark-theme .teacher-item-card,
body.dark-theme .teacher-student-card,
body.dark-theme .teacher-grade-row,
body.dark-theme .teacher-denied-card,
body.dark-theme .kundelik-summary-card,
body.dark-theme .schedule-day-card,
body.dark-theme .student-hw-card,
body.dark-theme .flashcards-lobby-card,
body.dark-theme .flashcards-unit-btn,
body.dark-theme .flashcard-front,
body.dark-theme .flashcard-back,
body.dark-theme .flashcard-example-box,
body.dark-theme .games-mode-card,
body.dark-theme .sor-lobby-card,
body.dark-theme .sor-q-card,
body.dark-theme .sor-result-card,
body.dark-theme .tetris-console,
body.dark-theme .clan-dashboard-card,
body.dark-theme .clan-card,
body.dark-theme .modal-window,
body.dark-theme .duo-btn-white,
body.dark-theme .unit-tab-pill,
body.dark-theme .teacher-tab-btn,
body.dark-theme .teacher-cat-pill,
body.dark-theme .teacher-score-btn,
body.dark-theme .node-popover {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .teacher-input,
body.dark-theme .duo-input,
body.dark-theme .chatbot-input,
body.dark-theme select,
body.dark-theme textarea,
body.dark-theme input[type="text"],
body.dark-theme input[type="password"],
body.dark-theme input[type="number"],
body.dark-theme input[type="date"] {
  background-color: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .teacher-empty,
body.dark-theme .kundelik-weight-tile,
body.dark-theme .teacher-meta-chip,
body.dark-theme .teacher-chip-btn {
  background-color: #142026 !important;
  border-color: #2b3f4a !important;
  color: #cbd5e1 !important;
}

body.dark-theme .schedule-day-card.has-lesson {
  background: rgba(16, 185, 129, 0.14) !important;
  border-color: #10b981 !important;
}

body.dark-theme .schedule-day-lesson,
body.dark-theme .flashcard-word-ru,
body.dark-theme .flashcard-example-text {
  color: #f1f5f9 !important;
}

body.dark-theme .lesson-screen,
body.dark-theme .complete-screen,
body.dark-theme .chatbot-window,
body.dark-theme .chatbot-messages {
  background-color: #131f24 !important;
  color: #f1f5f9 !important;
}

body.dark-theme .chatbot-msg.bot {
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .fast-reader-canvas {
  background-color: #16232a !important;
  border-color: #2b3f4a !important;
}

body.dark-theme .teacher-tab-btn.active,
body.dark-theme .teacher-cat-pill.active,
body.dark-theme .unit-tab-pill.active {
  background: rgba(28, 176, 246, 0.22) !important;
  border-color: #1cb0f6 !important;
  color: #7dd3fc !important;
}

body.dark-theme .teacher-chip-btn.submitted {
  background: rgba(34, 197, 94, 0.2) !important;
  border-color: #22c55e !important;
  color: #86efac !important;
}

body.dark-theme .node-label,
body.dark-theme .mascot-speech-bubble,
body.dark-theme .mascot-speech-bubble::after,
body.dark-theme .prompt-speech-bubble,
body.dark-theme .prompt-speech-bubble::before,
body.dark-theme .barys-streak-bubble,
body.dark-theme .kz-letters-trainer {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
  box-shadow: 0 3px 0 #0f172a !important;
}

body.dark-theme .mascot-speech-bubble::after,
body.dark-theme .prompt-speech-bubble::before {
  box-shadow: none !important;
}

body.dark-theme .path-mascot-companion {
  filter: drop-shadow(0 4px 12px rgba(15, 23, 42, 0.65)) !important;
}

/* Comprehensive Dark Theme Surfaces & Borders across All Sections (v128.0) */
body.dark-theme .textbook-card,
body.dark-theme .textbook-card-modern,
body.dark-theme .textbook-preview,
body.dark-theme .tb-vocab-card,
body.dark-theme .pdf-reader-shell,
body.dark-theme .pdf-reader-toolbar,
body.dark-theme .fast-reader-controls,
body.dark-theme .fast-reader-page-box,
body.dark-theme .fast-bookmark-pill,
body.dark-theme .modal-window-modern,
body.dark-theme .modal-header-modern,
body.dark-theme .modal-header,
body.dark-theme .modal-content-scroll,
body.dark-theme .modal-scroll-modern,
body.dark-theme .grammar-block,
body.dark-theme .grammar-table-wrapper,
body.dark-theme .kz-letter-detail-box,
body.dark-theme .kz-letter-pill,
body.dark-theme .kz-ex-chip,
body.dark-theme .letter-card,
body.dark-theme .letter-chip,
body.dark-theme .daily-phrase-card,
body.dark-theme .declension-container,
body.dark-theme .declension-search-box,
body.dark-theme .declension-input,
body.dark-theme .preset-chip,
body.dark-theme .cases-card-table,
body.dark-theme .case-row-item,
body.dark-theme .trainer-box,
body.dark-theme .trainer-choice-btn,
body.dark-theme .word-analysis-output,
body.dark-theme .word-card-full,
body.dark-theme .sound-box,
body.dark-theme .word-chip,
body.dark-theme .pair-card,
body.dark-theme .notebook-card,
body.dark-theme .notebook-word-token,
body.dark-theme .node-popover-card,
body.dark-theme .streak-celebration-card,
body.dark-theme .streak-modal-window,
body.dark-theme .lesson-header,
body.dark-theme .lesson-footer-drawer,
body.dark-theme .clan-roster-container,
body.dark-theme .clan-chat-card,
body.dark-theme .clan-quest-card,
body.dark-theme .clan-card-badge-box,
body.dark-theme .duo-friends-box,
body.dark-theme .duo-friend-row,
body.dark-theme .duo-profile-stat-card,
body.dark-theme .duo-profile-security-box,
body.dark-theme .duo-achievement-card,
body.dark-theme .dm-modal-window,
body.dark-theme .dm-modal-header,
body.dark-theme .dm-preset-btn,
body.dark-theme .auth-account-card,
body.dark-theme .auth-bonus-box,
body.dark-theme .welcome-card,
body.dark-theme .welcome-content-card,
body.dark-theme .welcome-form-card,
body.dark-theme .welcome-saved-box,
body.dark-theme .league-timer-box,
body.dark-theme .league-meta-pill,
body.dark-theme .league-div-pill,
body.dark-theme .sor-exam-card,
body.dark-theme .sor-passage-box,
body.dark-theme .sor-write-box,
body.dark-theme .sor-order-box,
body.dark-theme .sor-word-chip,
body.dark-theme .sor-choice-card,
body.dark-theme .sor-review-row,
body.dark-theme .sor-nav-pill,
body.dark-theme .cw-arena-card,
body.dark-theme .cw-question-box,
body.dark-theme .cw-team-box,
body.dark-theme .stat-card-box,
body.dark-theme .profile-hero,
body.dark-theme .profile-stat-box,
body.dark-theme .kz-journey-map-card,
body.dark-theme .kz-region-card {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .tb-nav-tabs,
body.dark-theme .tb-tab-btn,
body.dark-theme .auth-tab-btn,
body.dark-theme .cases-header-row,
body.dark-theme .grammar-table th,
body.dark-theme .grammar-table td,
body.dark-theme .clan-roster-table th,
body.dark-theme .clan-roster-table td {
  background-color: #16232a !important;
  border-color: #2b3f4a !important;
  color: #e2e8f0 !important;
}

body.dark-theme .tb-tab-btn.active,
body.dark-theme .auth-tab-btn.active,
body.dark-theme .preset-chip.active,
body.dark-theme .kz-letter-pill.active,
body.dark-theme .fast-bookmark-pill.active,
body.dark-theme .league-div-pill.active {
  background: rgba(28, 176, 246, 0.22) !important;
  border-color: #1cb0f6 !important;
  color: #7dd3fc !important;
}

body.dark-theme .case-quest-cell,
body.dark-theme .case-result-cell,
body.dark-theme .case-example-cell,
body.dark-theme .pdf-reader-title,
body.dark-theme .pdf-reader-sub,
body.dark-theme .modal-title,
body.dark-theme .modal-subtitle,
body.dark-theme .grammar-rule,
body.dark-theme .trainer-title,
body.dark-theme .lesson-question-title,
body.dark-theme .duo-profile-name,
body.dark-theme .duo-friend-name,
body.dark-theme .clan-card-name,
body.dark-theme .card-title {
  color: #f1f5f9 !important;
}

body.dark-theme .duo-profile-handle,
body.dark-theme .duo-profile-grade,
body.dark-theme .clan-card-desc,
body.dark-theme .clan-card-leader,
body.dark-theme .duo-friend-meta,
body.dark-theme .stat-card-lbl {
  color: #9fb3bd !important;
}

/* Dark theme: Time-of-Day bar on pathway, Friends list & Clans empty/search (v129.0) */
body.dark-theme .steppe-time-bar,
body.dark-theme .clan-empty-state,
body.dark-theme .duo-friends-empty,
body.dark-theme .duo-discover-list,
body.dark-theme .duo-discover-row,
body.dark-theme .duo-profile-guest-card,
body.dark-theme .auth-input {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .steppe-time-label,
body.dark-theme .clan-empty-state h3,
body.dark-theme .clan-empty-state p {
  color: #e2e8f0 !important;
}

body.dark-theme .steppe-time-pills {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark-theme .duo-profile-avatar-drawer,
body.dark-theme .duo-profile-avatar-chip,
body.dark-theme .auth-avatar-chip {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
}

body.dark-theme .duo-profile-avatar-chip.active,
body.dark-theme .auth-avatar-chip.active {
  background: rgba(28, 176, 246, 0.22) !important;
  border-color: #ffc800 !important;
}

body.dark-theme .duo-profile-danger-box {
  background: rgba(239, 68, 68, 0.14) !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
}

body.dark-theme .duo-profile-danger-box .danger-title {
  color: #fca5a5 !important;
}

body.dark-theme .duo-profile-danger-box .danger-sub {
  color: #fecaca !important;
}

body.dark-theme .duo-profile-security-box summary {
  color: #f1f5f9 !important;
}

body.dark-theme .duo-friend-avatar,
body.dark-theme .user-avatar,
body.dark-theme .duo-profile-avatar-circle,
body.dark-theme .profile-mini-avatar-chip {
  background: #131f24 !important;
  background-color: #131f24 !important;
  border-color: #2b3f4a !important;
}

body.dark-theme .stat-item,
body.dark-theme .stat-fire,
body.dark-theme .stat-fire.inactive {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
}

body.dark-theme .stat-fire.inactive {
  color: #94a3b8 !important;
}

body.dark-theme .streak-day-circle {
  background: #2b3f4a !important;
  color: #e2e8f0 !important;
}

body.dark-theme .duo-profile-security-box {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .duo-profile-security-box input.auth-input {
  background: #131f24 !important;
  background-color: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .duo-discover-item {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .mode-toggle-group {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
}

body.dark-theme .mode-toggle-btn {
  background: transparent !important;
  color: #cbd5e1 !important;
}

body.dark-theme .mode-toggle-btn.active {
  background: rgba(28, 176, 246, 0.24) !important;
  color: #7dd3fc !important;
  box-shadow: none !important;
}

body.dark-theme .word-card-full .info,
body.dark-theme .word-analysis-output .info {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .word-card-full .info h3,
body.dark-theme .word-analysis-output .info h3,
body.dark-theme .word-card-full .info p,
body.dark-theme .word-analysis-output .info p {
  color: #f1f5f9 !important;
}

body.dark-theme .declension-translation-pill {
  background: rgba(245, 158, 11, 0.16) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  color: #fef3c7 !important;
}

body.dark-theme .declension-translation-pill span {
  color: #fcd34d !important;
}

body.dark-theme .badge-default {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #cbd5e1 !important;
}

body.dark-theme .auth-welcome-screen {
  background: #131f24 !important;
  color: #f1f5f9 !important;
}

/* Dark Theme inside Lesson Screen & Complete Screen (v134.0) */
body.dark-theme #lesson-screen,
body.dark-theme #complete-screen,
body.dark-theme .lesson-screen,
body.dark-theme .complete-screen {
  background: #131f24 !important;
  color: #f1f5f9 !important;
}

body.dark-theme .lesson-body,
body.dark-theme #lesson-body {
  background: #16232a !important;
  background-color: #16232a !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme #lesson-question-title,
body.dark-theme .lesson-question-title {
  color: #f1f5f9 !important;
}

body.dark-theme .duo-profile-grade {
  background: #1b2a32 !important;
  border: 1px solid #2b3f4a !important;
  color: #7dd3fc !important;
}

body.dark-theme .duo-profile-clan-pill,
body.dark-theme .duo-profile-clan-pill.empty {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #e2e8f0 !important;
}

body.dark-theme .duo-profile-clan-pill:hover {
  background: #233843 !important;
  border-color: #1cb0f6 !important;
}

body.dark-theme .lesson-progress-container {
  background: #2b3f4a !important;
}

body.dark-theme .word-answer-slots {
  background: #16232a !important;
  border-color: #2b3f4a !important;
}

body.dark-theme .word-chip.used {
  background: #131f24 !important;
  color: transparent !important;
  border-color: #22333c !important;
  box-shadow: none !important;
}

body.dark-theme .choice-card.selected,
body.dark-theme .pair-card.selected {
  background: rgba(28, 176, 246, 0.22) !important;
  border-color: #1cb0f6 !important;
  color: #7dd3fc !important;
}

body.dark-theme .choice-card.correct,
body.dark-theme .pair-card.matched {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
}

body.dark-theme .choice-card.wrong,
body.dark-theme .pair-card.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

body.dark-theme .lesson-footer-drawer.correct {
  background: #122b24 !important;
  border-top-color: #10b981 !important;
}

body.dark-theme .lesson-footer-drawer.correct .feedback-icon-circle {
  background: #10b981 !important;
  color: #ffffff !important;
}

body.dark-theme .lesson-footer-drawer.correct .feedback-message-box h3,
body.dark-theme .lesson-footer-drawer.correct .feedback-message-box p {
  color: #6ee7b7 !important;
}

body.dark-theme .lesson-footer-drawer.wrong {
  background: #2c161b !important;
  border-top-color: #ef4444 !important;
}

body.dark-theme .lesson-footer-drawer.wrong .feedback-icon-circle {
  background: #ef4444 !important;
  color: #ffffff !important;
}

body.dark-theme .lesson-footer-drawer.wrong .feedback-message-box h3,
body.dark-theme .lesson-footer-drawer.wrong .feedback-message-box p {
  color: #fca5a5 !important;
}

body.dark-theme .lesson-audio-btn,
body.dark-theme .audio-btn-lg,
body.dark-theme .notebook-sentence,
body.dark-theme .notebook-fix-options,
body.dark-theme .complete-stat-card {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .league-zone-divider.demotion-zone {
  background: rgba(239, 68, 68, 0.14) !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
  color: #fca5a5 !important;
}

body.dark-theme .league-zone-divider.promotion-zone {
  background: rgba(16, 185, 129, 0.14) !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
  color: #6ee7b7 !important;
}

/* Additional Dark Theme Polish (Shop, Games, Clans, Reader) (v139.0) */
body.dark-theme .games-mode-meta strong,
body.dark-theme .shop-card h4,
body.dark-theme .shop-card-title,
body.dark-theme .clan-name-title,
body.dark-theme .clan-description-text,
body.dark-theme .clan-stat-item {
  color: #f1f5f9 !important;
}

body.dark-theme .games-mode-meta small,
body.dark-theme .shop-card p,
body.dark-theme .shop-card-desc {
  color: #9fb3bd !important;
}

body.dark-theme .games-mode-card.active {
  background: rgba(28, 176, 246, 0.2) !important;
  border-color: #1cb0f6 !important;
}

body.dark-theme .shop-cat-pill,
body.dark-theme .shop-wallet-pill,
body.dark-theme .shop-owned-pill,
body.dark-theme .pdf-fullscreen-btn {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #e2e8f0 !important;
}

body.dark-theme .fast-reader-page-box input {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme #kz-tutor-key-bar {
  background: #16232a !important;
  border-color: #2b3f4a !important;
}

/* ==========================================================================
   AITYLYM 26 TOPICS ACCORDION & PROGRESS (v141.0)
   ========================================================================== */
.aitylym-hero {
  background: linear-gradient(135deg, #0284c7 0%, #10b981 100%);
  color: #ffffff;
  border-radius: 22px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: 0 10px 26px rgba(2, 132, 199, 0.24);
  margin-bottom: 18px;
}
.aitylym-hero h2 { margin: 4px 0 6px; font-size: 26px; font-weight: 900; }
.aitylym-hero p { margin: 0; font-size: 14px; opacity: 0.94; max-width: 560px; }
.aitylym-progress-card {
  min-width: 220px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 12px 16px;
}

.aitylym-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
@media (max-width: 820px) {
  .aitylym-list {
    grid-template-columns: 1fr;
  }
}

.aitylym-progress-track {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.aitylym-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4ade80 0%, #fef08a 100%);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.aitylym-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  border-radius: 18px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.14s ease;
}
.aitylym-card:hover {
  transform: translateY(-1px);
}
.aitylym-card.is-done {
  border-color: #86efac;
  background: #f0fdf4;
}
.aitylym-card.open {
  grid-column: 1 / -1;
  border-color: #38bdf8;
  box-shadow: 0 10px 26px rgba(14, 165, 233, 0.12);
}

.aitylym-card-head {
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  flex-wrap: wrap;
}
.aitylym-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 200px;
}
.aitylym-num {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 900;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aitylym-card.is-done .aitylym-num {
  background: #22c55e;
  color: #ffffff;
}
.aitylym-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--duo-text-dark);
  line-height: 1.3;
}
.aitylym-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.aitylym-done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 2px solid var(--duo-gray-border);
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}
.aitylym-card.is-done .aitylym-done-toggle {
  background: #dcfce7;
  border-color: #22c55e;
  color: #15803d;
}
.aitylym-done-toggle.locked {
  cursor: default;
}
.aitylym-grade-select {
  border: 2px solid var(--duo-gray-border);
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #f8fafc;
  color: var(--duo-text-dark);
  font-family: inherit;
  cursor: pointer;
}
.aitylym-chevron-btn {
  border: none;
  background: #f1f5f9;
  color: #475569;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.aitylym-card-body {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}
.aitylym-card-body.open {
  grid-template-rows: 1fr;
  opacity: 1;
}
.aitylym-body-inner {
  overflow: hidden;
}
.aitylym-body-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--duo-gray-border);
  background: #f8fafc;
}
.aitylym-sentences-list {
  list-style: none;
  margin: 0;
  padding: 10px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aitylym-sentence-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  animation: aitylymFadeIn 0.28s ease both;
}
@keyframes aitylymFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.aitylym-s-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aitylym-s-texts { flex: 1; min-width: 0; }
.aitylym-s-kz { font-size: 15px; font-weight: 800; color: var(--duo-text-dark); line-height: 1.35; }
.aitylym-s-ru { font-size: 12.5px; font-weight: 700; color: var(--duo-gray-dark); margin-top: 2px; }

/* Dark theme for Aitylym */
body.dark-theme .aitylym-card {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
}
body.dark-theme .aitylym-card.is-done {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: #10b981 !important;
}
body.dark-theme .aitylym-title,
body.dark-theme .aitylym-s-kz {
  color: #f1f5f9 !important;
}
body.dark-theme .aitylym-s-ru {
  color: #9fb3bd !important;
}
body.dark-theme .aitylym-body-toolbar,
body.dark-theme .aitylym-sentence-item,
body.dark-theme .aitylym-done-toggle,
body.dark-theme .aitylym-grade-select,
body.dark-theme .aitylym-chevron-btn {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #e2e8f0 !important;
}
body.dark-theme .aitylym-card.is-done .aitylym-done-toggle {
  background: rgba(34, 197, 94, 0.2) !important;
  border-color: #22c55e !important;
  color: #86efac !important;
}

/* Dark theme for AI Assistant (.kz-tutor-*) & Welcome/Login Screen (v142.0) */
body.dark-theme .kz-tutor-drawer {
  background: #16232a !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .kz-tutor-chips,
body.dark-theme .kz-tutor-messages,
body.dark-theme .kz-tutor-input-row {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
}
body.dark-theme .kz-tutor-chip,
body.dark-theme .kz-tutor-followup-btn,
body.dark-theme .kz-tutor-speak-btn,
body.dark-theme .kz-tutor-msg.bot .kz-tutor-bubble {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .kz-tutor-input {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .kz-tutor-kz-pill {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #6ee7b7 !important;
}
body.dark-theme .kz-tutor-fab {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme #auth-welcome-screen,
body.dark-theme .auth-welcome-screen {
  background: radial-gradient(circle at top, #1b2a32 0%, #131f24 70%) !important;
}
body.dark-theme .welcome-card,
body.dark-theme .welcome-content-card,
body.dark-theme .welcome-form-card,
body.dark-theme .welcome-saved-box {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .welcome-card h1,
body.dark-theme .welcome-card h2,
body.dark-theme .welcome-card h3,
body.dark-theme .auth-welcome-screen h2,
body.dark-theme .auth-welcome-screen h3,
body.dark-theme .welcome-card p,
body.dark-theme .welcome-card label {
  color: #f1f5f9 !important;
}
body.dark-theme .welcome-saved-chip {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

body.dark-theme .steppe-time-pill {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #cbd5e1 !important;
}

body.dark-theme .steppe-time-pill.active {
  background: rgba(28, 176, 246, 0.24) !important;
  border-color: #1cb0f6 !important;
  color: #7dd3fc !important;
}

body.dark-theme .blitz-card {
  background: #131f24 !important;
  background-color: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .blitz-card .choice-card:not(.correct):not(.wrong):not(.selected) {
  background: #16232a !important;
  background-color: #16232a !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}

/* Dark theme fixes for clan emblem picker, clan badges, and league student/class pills */
body.dark-theme .clan-emblem-option {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .clan-emblem-option:hover {
  background: #1b2a32 !important;
  border-color: #1cb0f6 !important;
}
body.dark-theme .clan-emblem-option.selected {
  background: rgba(28, 176, 246, 0.2) !important;
  border-color: #1cb0f6 !important;
  box-shadow: 0 0 0 2px rgba(28, 176, 246, 0.4) !important;
}
body.dark-theme .clan-emblem-name {
  color: #e2e8f0 !important;
}
body.dark-theme .clan-tag-badge {
  background: rgba(28, 176, 246, 0.18) !important;
  border-color: #1cb0f6 !important;
  color: #7dd3fc !important;
}
body.dark-theme .clan-tag-mini {
  background: rgba(245, 158, 11, 0.18) !important;
  border-color: #f59e0b !important;
  color: #fcd34d !important;
}
body.dark-theme .role-leader {
  background: rgba(245, 158, 11, 0.2) !important;
  border-color: #f59e0b !important;
  color: #fcd34d !important;
}
body.dark-theme .role-member {
  background: #131f24 !important;
  border: 1px solid #2b3f4a !important;
  color: #cbd5e1 !important;
}
body.dark-theme .league-pill-registered {
  background: rgba(28, 176, 246, 0.18) !important;
  border-color: #1cb0f6 !important;
  color: #7dd3fc !important;
}
body.dark-theme .league-pill-class {
  background: #131f24 !important;
  border: 1px solid #2b3f4a !important;
  color: #cbd5e1 !important;
}

body.dark-theme .node-btn.locked {
  background: #1b2a32 !important;
  color: #64748b !important;
  box-shadow: 0 8px 0 #0f172a !important;
}

body.dark-theme .quest-progress-bar {
  background: #131f24 !important;
  border: 1px solid #2b3f4a;
}

/* Complete dark-theme polish across Склонятор, Айтылым, Магазин, Профиль, Панель учителя, Квесты */
body.dark-theme .morph-root {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
}
body.dark-theme .aitylym-num {
  background: rgba(28, 176, 246, 0.18) !important;
  color: #7dd3fc !important;
  border: 1px solid rgba(28, 176, 246, 0.35);
}
body.dark-theme .shop-card-icon-wrap {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
}
body.dark-theme .quest-icon {
  background: #131f24 !important;
  border: 1px solid #2b3f4a;
}
body.dark-theme .duo-ach-progress-track {
  background: #131f24 !important;
  border: 1px solid #2b3f4a;
}
body.dark-theme .duo-profile-stat-icon,
body.dark-theme .duo-stat-icon-box {
  background: #131f24 !important;
  border: 1px solid #2b3f4a;
}
body.dark-theme .duo-profile-avatar-edit-btn {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .duo-frame-req {
  background: #131f24 !important;
  color: #9fb3bd !important;
  border: 1px solid #2b3f4a;
}
body.dark-theme .duo-frame-card.selected .duo-frame-req {
  background: rgba(28, 176, 246, 0.2) !important;
  color: #7dd3fc !important;
  border-color: #1cb0f6;
}
.teacher-badge-blue {
  background: #e0f2fe;
  color: #0369a1;
}
body.dark-theme .teacher-badge-blue {
  background: rgba(28, 176, 246, 0.18) !important;
  color: #7dd3fc !important;
  border: 1px solid rgba(28, 176, 246, 0.35);
}
body.dark-theme .kundelik-weight-tile {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
}
body.dark-theme .kundelik-wt-top {
  color: #cbd5e1 !important;
}
body.dark-theme .kundelik-quarter-box,
body.dark-theme .kundelik-mini-grade,
body.dark-theme .teacher-avg-pill {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .kundelik-quarter-box.high,
body.dark-theme .kundelik-mini-grade.high {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: #22c55e !important;
  color: #86efac !important;
}
body.dark-theme .kundelik-quarter-box.mid,
body.dark-theme .kundelik-mini-grade.mid {
  background: rgba(234, 179, 8, 0.18) !important;
  border-color: #eab308 !important;
  color: #fde047 !important;
}
body.dark-theme .kundelik-quarter-box.low,
body.dark-theme .kundelik-mini-grade.low {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

/* Teacher student info dark theme text fix */
body.dark-theme .teacher-student-name {
  color: #f1f5f9 !important;
}
body.dark-theme .teacher-student-sub {
  color: #9fb3bd !important;
}
body.dark-theme .teacher-student-metrics {
  color: #cbd5e1 !important;
}

/* Mobile geometry, stretched header stats, and clean non-overlapping Tetris start screen */
@media (max-width: 768px) {
  .top-header .header-left {
    display: none !important;
  }
  .top-header .header-stats {
    width: 100% !important;
    flex: 1 1 100% !important;
    justify-content: space-between !important;
    gap: 6px !important;
  }
  .top-header .header-stats .stat-item {
    flex: 1 1 0 !important;
    justify-content: center !important;
    padding: 5px 6px !important;
    font-size: 12px !important;
    min-width: 0 !important;
  }
  .top-header .sound-toggle-btn,
  .top-header #header-user-btn {
    flex-shrink: 0 !important;
  }
  .tetris-console .tetris-arena {
    height: auto !important;
    min-height: 215px !important;
  }
  .tetris-console .tetris-start-overlay {
    position: relative !important;
    inset: auto !important;
    min-height: 205px !important;
    padding: 14px 12px !important;
    gap: 6px !important;
  }
  .tetris-console .tetris-start-overlay h3 {
    font-size: 16px !important;
    margin: 4px 0 !important;
  }
  .tetris-console .tetris-start-overlay p {
    font-size: 12.5px !important;
    margin: 0 0 8px !important;
    line-height: 1.35 !important;
  }
  .flashcard-scene {
    min-height: 310px !important;
  }
  .flashcard-face {
    padding: 16px 14px !important;
  }
  .flashcard-example-box {
    margin-top: 8px !important;
    padding: 8px 10px !important;
  }
  .aitylym-card-head {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .aitylym-head-right {
    margin-left: auto !important;
  }
}

.morph-part {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.15;
  padding: 6px 11px;
  vertical-align: middle;
}
.morph-part b {
  font-size: 15px;
  font-weight: 900;
}
.morph-part small {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.85;
  white-space: nowrap;
}

/* Dark theme for modal close button, tetris stop button, flashcard pills */
body.dark-theme .modal-close-btn {
  background: #131f24 !important;
  color: #f1f5f9 !important;
  border: 1px solid #2b3f4a !important;
  border-radius: 50% !important;
  width: 34px !important;
  height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}
body.dark-theme .tetris-exit-btn {
  background: rgba(239, 68, 68, 0.18) !important;
  border: 1px solid #ef4444 !important;
  color: #fca5a5 !important;
}
body.dark-theme .flashcards-unit-count,
body.dark-theme .flashcard-face-tag,
body.dark-theme .flashcard-unit-pill {
  background: rgba(28, 176, 246, 0.18) !important;
  border-color: rgba(28, 176, 246, 0.35) !important;
  color: #7dd3fc !important;
}
.teacher-badge-green {
  background: #dcfce7;
  color: #15803d;
}
body.dark-theme .teacher-badge-green {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #86efac !important;
  border: 1px solid rgba(34, 197, 94, 0.4);
}
body.dark-theme .kz-region-badge,
body.dark-theme .duo-banner-location {
  background: rgba(19, 31, 36, 0.86) !important;
  color: #f1f5f9 !important;
  border-color: #2b3f4a !important;
}

/* Comprehensive Mobile Geometry & Ergonomics (<= 768px) */
@media (max-width: 768px) {
  .main-content {
    padding-bottom: 92px !important;
  }
  .kz-tutor-fab {
    width: 44px !important;
    height: 44px !important;
    bottom: 70px !important;
    right: 10px !important;
    font-size: 20px !important;
    opacity: 0.92;
  }

  /* Textbook modal: near full-width, single-row tabs & nav, zero clipping */
  #modal-textbook.modal-overlay {
    padding: 6px !important;
  }
  #modal-textbook .modal-window {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    max-height: 95dvh !important;
    padding: 10px !important;
    border-radius: 18px !important;
  }
  #modal-textbook .modal-header {
    gap: 8px !important;
    margin-bottom: 8px !important;
  }
  #modal-textbook .modal-tabs,
  #modal-textbook .unit-switcher-nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 6px !important;
    padding-bottom: 4px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
  }
  #modal-textbook .modal-tab-btn,
  #modal-textbook .unit-tab-pill {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 12.5px !important;
    padding: 7px 10px !important;
  }
  .pdf-reader-toolbar {
    padding: 8px 10px !important;
    margin-bottom: 6px !important;
  }
  .pdf-reader-title {
    font-size: 13px !important;
  }
  .pdf-reader-sub {
    display: none !important;
  }
  .fast-reader-controls {
    padding: 6px 8px !important;
    margin-bottom: 6px !important;
  }
  .fast-reader-nav {
    width: 100% !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 4px !important;
  }
  #fast-reader-prev,
  #fast-reader-next {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 7px 8px !important;
    font-size: 11.5px !important;
  }
  .fast-reader-page-box {
    white-space: nowrap !important;
    padding: 4px 6px !important;
    font-size: 11.5px !important;
    gap: 4px !important;
    flex-shrink: 1 !important;
  }
  .fast-reader-page-box input {
    width: 38px !important;
    padding: 3px 4px !important;
    font-size: 12.5px !important;
  }
  .fast-reader-canvas {
    max-height: calc(94dvh - 210px) !important;
    padding: 4px !important;
  }
  .fast-reader-canvas img {
    max-height: calc(94dvh - 222px) !important;
  }

  /* Dictionary & Teacher tabs: clean horizontal scroll on single row */
  #view-dictionary .unit-switcher-nav,
  .teacher-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 6px !important;
    padding-bottom: 6px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
  }
  #view-dictionary .unit-tab-pill,
  .teacher-tab-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 12.5px !important;
    padding: 8px 12px !important;
  }

  /* Teacher grade type pills: keep on 1 line */
  .teacher-cat-pills {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .teacher-cat-pill {
    white-space: nowrap !important;
    font-size: 12px !important;
    padding: 7px 10px !important;
  }

  /* Unit banners & steppe bar */
  .unit-banner .unit-badge,
  .unit-header-badge {
    white-space: nowrap !important;
    font-size: 11px !important;
  }
  .steppe-time-bar {
    padding: 8px 10px !important;
    gap: 6px !important;
  }

  /* Declension tool: full-width input, tight chips, inline speaker */
  .declension-input-box,
  .declension-input-row {
    width: 100% !important;
    max-width: 100% !important;
  }
  .declension-input-box input,
  #declension-word-input {
    width: 100% !important;
    max-width: 100% !important;
  }
  .preset-cats-row {
    gap: 6px !important;
    row-gap: 6px !important;
  }
  .morph-card p {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  /* Games mode grid & Tetris mobile fit above bottom nav */
  .games-mode-cards {
    align-items: stretch !important;
  }
  .games-mode-card {
    height: 100% !important;
    min-height: 62px !important;
    padding: 8px !important;
    margin: 0 !important;
  }
  .tetris-console .tetris-arena {
    min-height: 155px !important;
  }
  .tetris-console .tetris-start-overlay {
    min-height: 150px !important;
    padding: 8px 10px !important;
  }

  /* Aitylym mobile card header */
  .aitylym-card-head {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .aitylym-head-right {
    width: 100% !important;
    justify-content: space-between !important;
    margin-left: 0 !important;
  }

  /* League mode toggle & rows */
  #view-leaderboard .unit-switcher-nav {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
  }
  #view-leaderboard .unit-tab-pill {
    white-space: nowrap !important;
    font-size: 11.5px !important;
    padding: 8px 6px !important;
    text-align: center !important;
    justify-content: center !important;
  }

  /* Profile 2x2 stats grid & single-line buttons */
  .duo-profile-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .duo-profile-actions .duo-btn {
    white-space: nowrap !important;
    font-size: 12px !important;
    padding: 8px 10px !important;
  }
}


/* =========================================================================
   INTERACTIVE COMICS (6-СЫНЫП ДИАЛОГИ С ИЛЛЮСТРАЦИЯМИ)
   ========================================================================= */
.comics-lobby {
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid var(--duo-border, #e5e7eb);
  border-radius: 22px;
  padding: 20px;
}

.comics-lobby-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.comics-lobby-head h3 {
  font-size: 20px;
  font-weight: 900;
  color: var(--duo-text-dark, #1e293b);
  margin: 0 0 4px;
}

.comics-lobby-head p {
  font-size: 13px;
  color: var(--duo-gray-dark, #64748b);
  margin: 0;
}

.comics-progress-pill {
  background: #ecfdf5;
  color: #059669;
  border: 2px solid #a7f3d0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
}

.comics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.comic-card {
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid var(--duo-border, #e5e7eb);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  display: flex;
  flex-direction: column;
}

.comic-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  border-color: #38bdf8;
}

.comic-card.done {
  border-color: #86efac;
}

.comic-card-img-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0f172a;
}

.comic-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.comic-unit-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.comic-unit-badge.inline {
  position: static;
  box-shadow: none;
}

.comic-done-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(16, 185, 129, 0.94);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
}

.comic-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.comic-card-body h4 {
  font-size: 16px;
  font-weight: 900;
  color: var(--duo-text-dark, #1e293b);
  margin: 0 0 4px;
}

.comic-card-body p {
  font-size: 13px;
  color: var(--duo-gray-dark, #64748b);
  margin: 0 0 12px;
  line-height: 1.4;
  flex: 1;
}

.comic-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.comic-grammar-tag {
  font-size: 11px;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  padding: 4px 8px;
  border-radius: 8px;
}

.comic-play-btn {
  font-size: 12px;
  font-weight: 900;
  color: #0284c7;
}

.comic-reader {
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid var(--duo-border, #e5e7eb);
  border-radius: 22px;
  padding: 18px;
}

.comic-reader-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.comic-reader-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 16px;
  color: var(--duo-text-dark, #1e293b);
}

.comic-scene-hero {
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid #1e293b;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
  margin-bottom: 16px;
  background: #0f172a;
}

.comic-scene-hero img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
}

.comic-scene-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
}

.comic-dialogue-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comic-bubble-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: comicPopIn 0.22s ease;
}

.comic-bubble-row.right {
  flex-direction: row-reverse;
}

@keyframes comicPopIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.comic-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.comic-bubble {
  max-width: 78%;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px 14px;
}

.comic-bubble-row.right .comic-bubble {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.comic-bubble-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #475569;
}

.comic-speak-btn {
  border: none;
  background: #e0f2fe;
  color: #0284c7;
  border-radius: 8px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 13px;
}

.comic-kz-text {
  font-size: 15px;
  font-weight: 800;
  color: var(--duo-text-dark, #0f172a);
  line-height: 1.45;
}

.comic-ru-text {
  font-size: 13px;
  color: var(--duo-gray-dark, #64748b);
  margin-top: 4px;
  line-height: 1.35;
}

.comic-reader-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.comic-challenge-box {
  margin-top: 8px;
  background: #f8fafc;
  border: 2px dashed #6366f1;
  border-radius: 18px;
  padding: 16px;
}

.comic-challenge-prompt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.comic-options-label {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  color: #4f46e5;
  margin-bottom: 8px;
}

.comic-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comic-option-btn {
  text-align: left;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.comic-option-btn:hover:not(:disabled) {
  border-color: #6366f1;
  background: #eef2ff;
}

.comic-option-btn.correct {
  border-color: #22c55e;
  background: #dcfce7;
}

.comic-option-btn.wrong {
  border-color: #ef4444;
  background: #fee2e2;
}

.comic-opt-kz {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.comic-opt-ru {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.comic-feedback {
  margin-top: 12px;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.comic-feedback.ok {
  background: #dcfce7;
  border: 2px solid #86efac;
  color: #166534;
}

.comic-feedback.err {
  background: #fee2e2;
  border: 2px solid #fca5a5;
  color: #991b1b;
}

.comic-feedback p {
  margin: 4px 0 0;
  font-size: 13px;
}

/* =========================================================================
   TEACHER ERROR HEATMAP (ТЕПЛОВАЯ КАРТА ОШИБОК КЛАССА)
   ========================================================================= */
.teacher-heatmap-empty {
  text-align: center;
  padding: 36px 20px;
  background: var(--duo-card-bg, #ffffff);
  border: 2px dashed var(--duo-border, #cbd5e1);
  border-radius: 18px;
}

.teacher-heatmap-empty h3 {
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 8px;
}

.teacher-heatmap-empty p {
  max-width: 480px;
  margin: 0 auto 16px;
  font-size: 14px;
  color: var(--duo-gray-dark, #64748b);
}

.teacher-heatmap-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #fff1f2 0%, #fff7ed 100%);
  border: 2px solid #fecaca;
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.teacher-heatmap-banner h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 900;
  color: #9f1239;
}

.teacher-heatmap-banner p {
  margin: 0;
  font-size: 13px;
  color: #7f1d1d;
}

.teacher-demo-badge {
  background: #7c3aed;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}

.teacher-heatmap-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
}

@media (max-width: 860px) {
  .teacher-heatmap-grid {
    grid-template-columns: 1fr;
  }
}

.teacher-heatmap-panel {
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid var(--duo-border, #e5e7eb);
  border-radius: 18px;
  padding: 16px;
}

.teacher-heatmap-panel h4 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 900;
  color: var(--duo-text-dark, #1e293b);
}

.heatmap-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.heatmap-topic-card {
  border-radius: 14px;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
}

.heatmap-topic-card.heat-critical {
  background: #fef2f2;
  border-color: #fca5a5;
}

.heatmap-topic-card.heat-high {
  background: #fff7ed;
  border-color: #fdba74;
}

.heatmap-topic-card.heat-mid {
  background: #fefce8;
  border-color: #fde047;
}

.heatmap-topic-card.heat-low {
  background: #f0fdf4;
  border-color: #86efac;
}

.heatmap-topic-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.heatmap-level-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  color: #ffffff;
}

.heatmap-level-pill.heat-critical { background: #dc2626; }
.heatmap-level-pill.heat-high { background: #ea580c; }
.heatmap-level-pill.heat-mid { background: #ca8a04; }
.heatmap-level-pill.heat-low { background: #16a34a; }

.heatmap-count-badge {
  font-size: 13px;
  font-weight: 900;
  color: #0f172a;
  white-space: nowrap;
}

.heatmap-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.heatmap-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.heatmap-bar-fill.heat-critical { background: linear-gradient(90deg, #ef4444, #b91c1c); }
.heatmap-bar-fill.heat-high { background: linear-gradient(90deg, #fb923c, #ea580c); }
.heatmap-bar-fill.heat-mid { background: linear-gradient(90deg, #facc15, #ca8a04); }
.heatmap-bar-fill.heat-low { background: linear-gradient(90deg, #4ade80, #16a34a); }

.heatmap-topic-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.heatmap-students-list {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.heatmap-cat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.heatmap-cat-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 4px;
}

.heatmap-words-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.heatmap-word-pill {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.heatmap-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.heatmap-filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.heatmap-unit-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.heatmap-student-select {
  max-width: 240px;
  margin: 0 !important;
}

.heatmap-students-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.heatmap-student-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.heatmap-student-row strong {
  display: block;
  font-size: 13px;
  color: #0f172a;
}

.heatmap-student-row small {
  display: block;
  font-size: 11px;
  color: #64748b;
}

/* =========================================================================
   TEACHER COMIC CONSTRUCTOR (КОНСТРУКТОР КОМИКСОВ)
   ========================================================================= */
.comic-teacher-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(124, 58, 237, 0.92);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
}

.builder-bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.builder-bg-option {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 4px;
  background: #ffffff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.builder-bg-option img {
  width: 100%;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.builder-bg-option span {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: #475569;
  margin-top: 3px;
}

.builder-bg-option.active {
  border-color: #7c3aed;
  background: #f5f3ff;
  transform: translateY(-1px);
}

.builder-line-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 8px;
}

/* =========================================================================
   ASYK ATU (АСЫҚ АТУ — НАЦИОНАЛЬНАЯ ИГРА-ВИКТОРИНА)
   ========================================================================= */
.asyk-lobby-hero {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.asyk-piece {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #fef3c7;
  border: 2px solid #f59e0b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 3px 0 #d97706;
}

.asyk-piece.golden {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  border-color: #b45309;
  font-size: 28px;
}

.asyk-collection-pill {
  display: inline-block;
  background: #fef9c3;
  color: #854d0e;
  border: 2px solid #fde047;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
}

.asyk-arena-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.asyk-targets-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.asyk-target {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.asyk-target.golden {
  border-color: #f59e0b;
  background: #fef3c7;
}

.asyk-target.hit {
  transform: scale(0.9) rotate(-18deg);
  opacity: 0.45;
  background: #dcfce7;
  border-color: #22c55e;
}

.asyk-streak-badge {
  font-size: 13px;
  font-weight: 900;
  color: #b45309;
  background: #fef3c7;
  padding: 4px 10px;
  border-radius: 999px;
}

/* =========================================================================
   PERSONAL HARD WORDS DICTIONARY (ЛИЧНЫЙ СЛОВАРИК ТРУДНЫХ СЛОВ)
   ========================================================================= */
.hard-words-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #fff1f2 0%, #fefce8 100%);
  border: 2px solid #fecaca;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 6px;
}

.hard-words-banner h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 900;
  color: #9f1239;
}

.hard-words-banner p {
  margin: 0;
  font-size: 13px;
  color: #7f1d1d;
}

.hard-words-empty {
  text-align: center;
  padding: 34px 20px;
  background: var(--duo-card-bg, #ffffff);
  border: 2px dashed var(--duo-border, #cbd5e1);
  border-radius: 18px;
}

.hard-word-card {
  border-color: #fecaca !important;
}

.hard-word-badge {
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
}

.hard-drill-card {
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
  border: 2px solid #6366f1;
  border-radius: 18px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 8px;
}

.hard-drill-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: #4f46e5;
  margin-bottom: 10px;
}

.hard-drill-word {
  font-size: 26px;
  font-weight: 900;
  color: #0f172a;
}

.hard-drill-ru {
  font-size: 16px;
  font-weight: 800;
  color: #059669;
  margin-top: 6px;
}

.hard-drill-hint {
  font-size: 13px;
  color: #64748b;
  margin-top: 6px;
}

/* =========================================================================
   UPGRADED SHOP UI (СОВРЕМЕННАЯ СТИЛИЗАЦИЯ МАГАЗИНА И ТИТУЛОВ)
   ========================================================================= */
#shop-hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #0284c7 100%);
  color: #ffffff;
  border-radius: 22px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.shop-hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

#shop-hero-banner h3 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
}

#shop-hero-banner p {
  margin: 0;
  font-size: 13px;
  color: #cbd5e1;
}

.shop-hero-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.shop-wallet-pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #f8fafc;
}

.shop-wallet-pill strong {
  font-size: 16px;
  font-weight: 900;
}

.shop-wallet-pill.active {
  background: rgba(250, 204, 21, 0.22);
  border-color: #facc15;
}

.shop-card-modern {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  border-radius: 20px !important;
  padding: 16px !important;
  border: 2px solid #e2e8f0 !important;
  background: var(--duo-card-bg, #ffffff) !important;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.shop-card-modern:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.09);
}

.shop-card-modern.is-equipped {
  border-color: #22c55e !important;
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.15);
}

.shop-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.shop-cat-pill {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}

.shop-accent-emerald .shop-cat-pill { background: #dcfce7; color: #15803d; }
.shop-accent-violet .shop-cat-pill { background: #ede9fe; color: #6d28d9; }
.shop-accent-ice .shop-cat-pill { background: #e0f2fe; color: #0369a1; }
.shop-accent-gold .shop-cat-pill { background: #fef3c7; color: #b45309; }
.shop-accent-rose .shop-cat-pill { background: #ffe4e6; color: #be123c; }

.shop-owned-pill {
  font-size: 10px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.shop-card-icon-wrap {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.shop-accent-emerald .shop-card-icon-wrap { background: #f0fdf4; border-color: #bbf7d0; }
.shop-accent-violet .shop-card-icon-wrap { background: #f5f3ff; border-color: #ddd6fe; }
.shop-accent-ice .shop-card-icon-wrap { background: #f0f9ff; border-color: #bae6fd; }
.shop-accent-rose .shop-card-icon-wrap { background: #fff1f2; border-color: #fecdd3; }

/* =========================================================================
   MODERN ANIMATED DROPDOWN (СОВРЕМЕННЫЕ ВЫПАДАЮЩИЕ СПИСКИ)
   ========================================================================= */
.modern-select-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 280px;
}

.modern-select-wrap.full-width {
  max-width: 100%;
}

.modern-select-native {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
}

.modern-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-text-dark, #1e293b);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.modern-select-trigger:hover {
  border-color: #38bdf8;
}

.modern-select-wrap.open .modern-select-trigger {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16);
}

.modern-select-chevron {
  font-size: 11px;
  color: #64748b;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.modern-select-wrap.open .modern-select-chevron {
  transform: rotate(180deg);
  color: #0284c7;
}

.modern-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 210px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
  z-index: 999;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.modern-select-wrap.open .modern-select-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.modern-select-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--duo-text-dark, #334155);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.modern-select-option:hover {
  background: #f0f9ff;
  color: #0284c7;
}

.modern-select-option.selected {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 900;
}

/* =========================================================================
   FULL-WIDTH TEACHER PANEL ON DESKTOP + DYNAMIC ASYK ATU STYLES
   ========================================================================= */
@media (min-width: 1024px) {
  #view-teacher.view-container {
    max-width: 100% !important;
    width: 100%;
    padding: 24px 32px;
  }
}

.asyk-hud-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.asyk-score-badge,
.asyk-round-badge {
  font-size: 13px;
  font-weight: 900;
  color: #1e293b;
  background: #ffffff;
  border: 1px solid #fde68a;
  padding: 4px 10px;
  border-radius: 999px;
}

.asyk-timer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.asyk-timer-track {
  flex: 1;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.asyk-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #0ea5e9);
  border-radius: 999px;
  transition: width 0.1s linear;
}

.asyk-timer-fill.danger {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.asyk-timer-text {
  font-size: 13px;
  font-weight: 900;
  color: #475569;
  min-width: 38px;
  text-align: right;
}

.asyk-opt-btn {
  display: flex !important;
  align-items: center;
  justify-content: flex-start !important;
  gap: 10px;
  padding: 12px 14px !important;
  font-weight: 800;
  text-align: left;
}

.asyk-key-hint {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.asyk-feedback-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 2px solid transparent;
}

.asyk-feedback-box.ok {
  background: rgba(34, 197, 94, 0.14);
  border-color: #22c55e;
  color: #166534;
}

.asyk-feedback-box.err {
  background: rgba(239, 68, 68, 0.14);
  border-color: #ef4444;
  color: #991b1b;
}

@keyframes asykShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.asyk-shake {
  animation: asykShake 0.36s ease;
}

/* =========================================================================
   DARK THEME FIXES FOR NEW MODULES (КОНСТРУКТОР, КОМИКСЫ, СПИСКИ, КАРТА)
   ========================================================================= */
body.dark-theme .builder-bg-option {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .builder-bg-option span {
  color: #cbd5e1;
}

body.dark-theme .builder-bg-option.active {
  background: #312e81;
  border-color: #8b5cf6;
}

body.dark-theme .builder-bg-option.active span {
  color: #ffffff;
}

body.dark-theme .builder-line-box {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .modern-select-trigger {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

body.dark-theme .modern-select-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
}

body.dark-theme .modern-select-option {
  color: #e2e8f0;
}

body.dark-theme .modern-select-option:hover {
  background: #0f172a;
  color: #38bdf8;
}

body.dark-theme .modern-select-option.selected {
  background: rgba(14, 165, 233, 0.22);
  color: #38bdf8;
}

body.dark-theme .comics-lobby,
body.dark-theme .comic-card,
body.dark-theme .comic-reader,
body.dark-theme .teacher-heatmap-panel,
body.dark-theme .teacher-heatmap-empty,
body.dark-theme .hard-words-empty {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .comic-bubble {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .comic-bubble-row.right .comic-bubble {
  background: #172554;
  border-color: #1d4ed8;
}

body.dark-theme .comic-bubble-head,
body.dark-theme .comic-ru-text,
body.dark-theme .comic-opt-ru,
body.dark-theme .heatmap-students-list {
  color: #94a3b8;
}

body.dark-theme .comic-kz-text,
body.dark-theme .comic-opt-kz,
body.dark-theme .comic-card-body h4,
body.dark-theme .comic-reader-title,
body.dark-theme .heatmap-count-badge,
body.dark-theme .hard-drill-word {
  color: #f1f5f9;
}

body.dark-theme .comic-avatar {
  background: #0f172a;
  border-color: #475569;
}

body.dark-theme .comic-challenge-box {
  background: #0f172a;
  border-color: #6366f1;
}

body.dark-theme .comic-option-btn {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .comic-option-btn:hover:not(:disabled) {
  background: #312e81;
  border-color: #818cf8;
}

body.dark-theme .comic-option-btn.correct {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
}

body.dark-theme .comic-option-btn.wrong {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

body.dark-theme .comic-grammar-tag {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

body.dark-theme .teacher-heatmap-banner {
  background: linear-gradient(135deg, rgba(159, 18, 57, 0.25), rgba(154, 52, 18, 0.2));
  border-color: #9f1239;
}

body.dark-theme .teacher-heatmap-banner h3,
body.dark-theme .teacher-heatmap-banner p {
  color: #fecdd3;
}

body.dark-theme .heatmap-topic-card {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .heatmap-topic-card.heat-critical {
  background: rgba(220, 38, 38, 0.14);
  border-color: #dc2626;
}

body.dark-theme .heatmap-topic-card.heat-high {
  background: rgba(234, 88, 12, 0.14);
  border-color: #ea580c;
}

body.dark-theme .heatmap-topic-card.heat-mid {
  background: rgba(202, 138, 4, 0.14);
  border-color: #ca8a04;
}

body.dark-theme .heatmap-topic-card.heat-low {
  background: rgba(22, 163, 74, 0.14);
  border-color: #16a34a;
}

body.dark-theme .heatmap-student-row {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .heatmap-student-row strong {
  color: #f1f5f9;
}

body.dark-theme .heatmap-student-row small {
  color: #94a3b8;
}

body.dark-theme .asyk-arena-bar {
  background: rgba(245, 158, 11, 0.12);
  border-color: #b45309;
}

body.dark-theme .asyk-target,
body.dark-theme .asyk-score-badge,
body.dark-theme .asyk-round-badge,
body.dark-theme .asyk-key-hint {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark-theme .asyk-feedback-box.ok {
  color: #86efac;
}

body.dark-theme .asyk-feedback-box.err {
  color: #fca5a5;
}

body.dark-theme .hard-drill-card {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  border-color: #6366f1;
}

body.dark-theme .hard-words-banner {
  background: linear-gradient(135deg, rgba(159, 18, 57, 0.22), rgba(161, 98, 7, 0.18));
  border-color: #be123c;
}

body.dark-theme .hard-words-banner h3,
body.dark-theme .hard-words-banner p {
  color: #fecdd3;
}

/* =========================================================================
   CHEAT SHEET MODAL (ШПАРГАЛКА НА ОДНОМ ЭКРАНЕ)
   ========================================================================= */
.cheat-sheet-window {
  max-width: 820px !important;
  width: 94%;
}

.cheat-sheet-body {
  padding: 18px 22px 24px !important;
}

.cheat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.cheat-span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .cheat-grid { grid-template-columns: 1fr; }
}

.cheat-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px 16px;
}

.cheat-card h4 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 900;
  color: #0f172a;
}

.cheat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cheat-table th,
.cheat-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
}

.cheat-table th {
  font-size: 11px;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 900;
}

.cheat-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
}

/* =========================================================================
   WORD FAMILY CHAINS IN DICTIONARY (СӨЗЖАСАМ)
   ========================================================================= */
.word-family-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.word-family-label {
  font-size: 11px;
  font-weight: 900;
  color: #059669;
}

.word-family-chip {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.12s ease, background 0.12s ease;
}

.word-family-chip:hover {
  background: #d1fae5;
  transform: translateY(-1px);
}

.word-family-chip small {
  opacity: 0.8;
}

/* =========================================================================
   SYNONYMS & ANTONYMS GAME (МӘНДЕС / ҚАРАМА-ҚАРСЫ)
   ========================================================================= */
.synant-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.synant-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.synant-tile {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-bottom-width: 4px;
  border-radius: 16px;
  padding: 12px 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.synant-tile strong {
  display: block;
  font-size: 16px;
  font-weight: 900;
  color: #0f172a;
}

.synant-tile small {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.synant-tile.picked {
  border-color: #0ea5e9;
  background: #e0f2fe;
  transform: scale(1.02);
}

.synant-tile.matched {
  border-color: #22c55e;
  background: #dcfce7;
  opacity: 0.55;
  cursor: default;
}

.synant-tile.wrong {
  border-color: #ef4444;
  background: #fee2e2;
  animation: asykShake 0.32s ease;
}

/* Dark theme overrides for Cheat Sheet, Word Family, Syn/Ant */
body.dark-theme .cheat-card {
  background: #0f172a;
  border-color: #334155;
}
body.dark-theme .cheat-card h4,
body.dark-theme .cheat-table td,
body.dark-theme .cheat-list,
body.dark-theme .synant-tile strong {
  color: #f1f5f9;
}
body.dark-theme .cheat-table th,
body.dark-theme .cheat-table td {
  border-color: #1e293b;
}
body.dark-theme .word-family-row {
  border-color: #334155;
}
body.dark-theme .word-family-chip {
  background: rgba(16, 185, 129, 0.16);
  border-color: #059669;
  color: #6ee7b7;
}
body.dark-theme .synant-tile {
  background: #1e293b;
  border-color: #334155;
}
body.dark-theme .synant-tile small {
  color: #94a3b8;
}
body.dark-theme .synant-tile.picked {
  background: rgba(14, 165, 233, 0.22);
  border-color: #38bdf8;
}
body.dark-theme .synant-tile.matched {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
}
body.dark-theme .synant-tile.wrong {
  background: rgba(239, 68, 68, 0.22);
  border-color: #ef4444;
}

/* =========================================================================
   DEDICATED SCHEDULE TAB IN TEACHER PANEL (ВКЛАДКА РАСПИСАНИЯ В ПУ)
   ========================================================================= */
.teacher-schedule-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.teacher-schedule-hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 2px solid #bae6fd;
  border-radius: 20px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.teacher-schedule-hero h3 {
  margin: 6px 0 4px;
  font-size: 20px;
  font-weight: 900;
  color: #0c4a6e;
}

.teacher-schedule-hero p {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0369a1;
}

.teacher-schedule-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.schedule-stat-chip {
  background: #ffffff;
  border: 2px solid #bae6fd;
  border-radius: 16px;
  padding: 10px 16px;
  text-align: center;
  min-width: 105px;
}

.schedule-stat-chip strong {
  display: block;
  font-size: 20px;
  font-weight: 900;
  color: #0284c7;
}

.schedule-stat-chip span {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
}

.teacher-schedule-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

@media (max-width: 960px) {
  .teacher-schedule-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .teacher-schedule-grid { grid-template-columns: 1fr; }
}

.t-sched-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-bottom-width: 4px;
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.t-sched-card.has-lesson {
  border-color: #bae6fd;
  background: linear-gradient(180deg, #ffffff 0%, #f0f9ff 100%);
}

.t-sched-card.no-lesson {
  background: #f8fafc;
  opacity: 0.85;
}

.t-sched-card.is-today {
  border-color: #0ea5e9;
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.18);
  transform: translateY(-2px);
}

.t-sched-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.t-sched-short {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.t-sched-card.no-lesson .t-sched-short {
  background: #e2e8f0;
  color: #64748b;
}

.t-sched-day {
  font-size: 16px;
  font-weight: 900;
  color: #0f172a;
}

.t-sched-lesson {
  font-size: 15px;
  font-weight: 900;
  color: #0284c7;
  background: #e0f2fe;
  padding: 6px 10px;
  border-radius: 10px;
  text-align: center;
}

.t-sched-card.no-lesson .t-sched-lesson {
  color: #64748b;
  background: #f1f5f9;
}

.t-sched-note {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

body.dark-theme .teacher-schedule-hero {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(30, 41, 59, 0.9));
  border-color: #0369a1;
}

body.dark-theme .teacher-schedule-hero h3 { color: #e0f2fe; }
body.dark-theme .teacher-schedule-hero p { color: #7dd3fc; }

body.dark-theme .schedule-stat-chip,
body.dark-theme .t-sched-card {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .t-sched-card.has-lesson {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-color: #0284c7;
}

body.dark-theme .t-sched-day { color: #f1f5f9; }
body.dark-theme .t-sched-short,
body.dark-theme .t-sched-lesson {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
}
body.dark-theme .t-sched-card.no-lesson .t-sched-short,
body.dark-theme .t-sched-card.no-lesson .t-sched-lesson {
  background: #0f172a;
  color: #94a3b8;
}

/* =========================================================================
   TEACHER PRESENTATIONS VIEWER (ПРОСМОТР ПРЕЗЕНТАЦИЙ НА УРОКЕ)
   ========================================================================= */
.pres-viewer-overlay {
  position: fixed;
  inset: 0;
  background: #0f172a;
  z-index: 99999;
  display: flex;
  flex-direction: column;
}

.pres-viewer-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  color: #f8fafc;
}

.pres-viewer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.pres-viewer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pres-slide-counter {
  font-size: 14px;
  font-weight: 900;
  color: #e2e8f0;
  padding: 0 8px;
}

.pres-viewer-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  background: #020617;
}

.pres-pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  background: #ffffff;
}

.pres-slide-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

/* =========================================================================
   MODERN FILE DROPZONE FOR PRESENTATIONS (КРАСИВЫЙ ВЫБОР ФАЙЛА)
   ========================================================================= */
.pres-file-hidden {
  display: none !important;
}

.pres-dropzone {
  margin-top: 6px;
  border: 2px dashed #93c5fd;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-radius: 18px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.pres-dropzone:hover,
.pres-dropzone.dragover {
  border-color: #0ea5e9;
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.14);
}

.pres-dropzone.has-files {
  border-style: solid;
  border-color: #22c55e;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
}

.pres-dz-icon {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 8px;
}

.pres-dz-title {
  font-size: 14px;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 8px;
  word-break: break-word;
}

.pres-dz-sub {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pres-fmt-pill {
  font-size: 11px;
  font-weight: 800;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  padding: 3px 9px;
  border-radius: 999px;
}

.pres-fmt-pill.active {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

body.dark-theme .pres-dropzone {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-color: #0284c7;
}

body.dark-theme .pres-dropzone:hover,
body.dark-theme .pres-dropzone.dragover {
  background: linear-gradient(135deg, #1e293b 0%, #172554 100%);
  border-color: #38bdf8;
}

body.dark-theme .pres-dropzone.has-files {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.16), #0f172a);
  border-color: #22c55e;
}

body.dark-theme .pres-dz-title {
  color: #f1f5f9;
}

body.dark-theme .pres-fmt-pill {
  background: rgba(14, 165, 233, 0.2);
  border-color: #0369a1;
  color: #7dd3fc;
}

body.dark-theme .pres-fmt-pill.active {
  background: rgba(34, 197, 94, 0.2);
  border-color: #16a34a;
  color: #86efac;
}

.modern-select-wrap.open {
  z-index: 1000;
}

/* =========================================================================
   COMPACT MODERN DROPDOWN FOR AITYLYM GRADE SELECT
   ========================================================================= */
.aitylym-card:has(.modern-select-wrap.open) {
  overflow: visible !important;
  position: relative;
  z-index: 60;
}

.modern-select-wrap.aitylym-grade-wrap {
  width: auto;
  max-width: 118px;
}

.modern-select-wrap.aitylym-grade-wrap .modern-select-trigger {
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
  gap: 6px;
  min-width: 90px;
}

.modern-select-wrap.aitylym-grade-wrap .modern-select-menu {
  left: auto;
  right: 0;
  min-width: 112px;
  max-height: 220px;
}

.modern-select-wrap.aitylym-grade-wrap .modern-select-option {
  padding: 6px 10px;
  font-size: 12px;
}

/* =========================================================================
   ACTIVITY MONITOR + ATTENDANCE + WHEEL OF FORTUNE (ПУ)
   ========================================================================= */
.teacher-activity-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.act-summary-pill,
.teacher-act-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
}

.teacher-act-pill { margin-top: 4px; }
.act-today { background: #dcfce7; color: #15803d; }
.act-recent { background: #fef9c3; color: #a16207; }
.act-stale { background: #fee2e2; color: #b91c1c; }
.act-none { background: #f1f5f9; color: #64748b; }

.att-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.att-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid var(--duo-border, #e2e8f0);
  border-radius: 18px;
  padding: 16px 20px;
}

.att-topbar h3 { margin: 0 0 4px; font-size: 18px; font-weight: 900; }
.att-topbar p { margin: 0; font-size: 13px; color: var(--duo-gray-dark); }

.att-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.att-stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.att-stat-pill {
  background: #f1f5f9;
  color: #334155;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
}

.att-stat-pill.att-present { background: #dcfce7; color: #15803d; }
.att-stat-pill.att-late { background: #fef3c7; color: #b45309; }
.att-stat-pill.att-sick { background: #e0f2fe; color: #0369a1; }
.att-stat-pill.att-absent { background: #fee2e2; color: #b91c1c; }

.att-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.att-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid var(--duo-border, #e2e8f0);
  border-radius: 16px;
  padding: 12px 16px;
}

.att-student-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.att-num {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.att-student-info strong { display: block; font-size: 14px; }
.att-student-info small { font-size: 11px; color: #64748b; }

.att-btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.att-btn {
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.att-btn.att-present.active { background: #22c55e; border-color: #16a34a; color: #fff; }
.att-btn.att-late.active { background: #f59e0b; border-color: #d97706; color: #fff; }
.att-btn.att-sick.active { background: #0ea5e9; border-color: #0284c7; color: #fff; }
.att-btn.att-absent.active { background: #ef4444; border-color: #dc2626; color: #fff; }

/* Wheel of Fortune */
.wheel-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .wheel-layout { grid-template-columns: 1fr; }
}

.wheel-stage-card {
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid var(--duo-border, #e2e8f0);
  border-radius: 22px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.wheel-pointer {
  font-size: 26px;
  line-height: 1;
  color: #ef4444;
  margin-bottom: -10px;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.fortune-wheel {
  position: relative;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  border: 6px solid #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2), inset 0 0 16px rgba(0, 0, 0, 0.15);
  transition: transform 3.2s cubic-bezier(0.15, 0.85, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-label {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90px;
  margin-left: -45px;
  margin-top: -10px;
  text-align: center;
  pointer-events: none;
}

.wheel-label span {
  display: inline-block;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wheel-center-cap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 3;
}

.wheel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.wheel-exclude-chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-gray-dark);
  cursor: pointer;
}

.wheel-winner-card {
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
  border: 2px solid #f59e0b;
  border-radius: 20px;
  padding: 22px;
  text-align: center;
}

.wheel-winner-card.empty {
  background: var(--duo-card-bg, #ffffff);
  border: 2px dashed var(--duo-border, #cbd5e1);
}

.wheel-winner-badge {
  display: inline-block;
  background: #f59e0b;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.wheel-winner-name {
  font-size: 26px;
  font-weight: 900;
  color: #0f172a;
}

.wheel-winner-sub {
  font-size: 13px;
  font-weight: 700;
  color: #78350f;
  margin-top: 4px;
}

body.dark-theme .att-topbar,
body.dark-theme .att-row,
body.dark-theme .wheel-stage-card,
body.dark-theme .wheel-winner-card.empty {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .att-btn {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-theme .wheel-winner-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), #1e293b);
}

body.dark-theme .wheel-winner-name { color: #fef08a; }
body.dark-theme .wheel-winner-sub { color: #fde68a; }

/* =========================================================================
   SVG FORTUNE WHEEL + MODERN CALENDAR DATE PICKER
   ========================================================================= */
.wheel-pointer-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #ffffff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: -18px;
  z-index: 6;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45);
}

.wheel-svg-box {
  width: 320px;
  height: 320px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fortune-wheel-svg {
  width: 100%;
  height: 100%;
  transition: transform 3.2s cubic-bezier(0.14, 0.86, 0.2, 1);
  filter: drop-shadow(0 12px 26px rgba(15, 23, 42, 0.22));
}

/* Modern Date Picker */
.modern-date-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}

.modern-date-wrap.open {
  z-index: 1001;
}

.modern-date-native {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
}

.modern-date-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--duo-text-dark, #1e293b);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.modern-date-trigger:hover {
  border-color: #38bdf8;
}

.modern-date-wrap.open .modern-date-trigger {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16);
}

.modern-date-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 280px;
  background: var(--duo-card-bg, #ffffff);
  border: 2px solid #e2e8f0;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  z-index: 1002;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.modern-date-wrap.open .modern-date-popover {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mdate-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.mdate-head strong {
  font-size: 14px;
  font-weight: 900;
  color: #0f172a;
}

.mdate-nav {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 11px;
  cursor: pointer;
}

.mdate-nav:hover {
  background: #e0f2fe;
  color: #0284c7;
}

.mdate-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.mdate-wd {
  font-size: 11px;
  font-weight: 900;
  color: #94a3b8;
  padding-bottom: 4px;
}

.mdate-day {
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.mdate-day:hover {
  background: #f0f9ff;
  color: #0284c7;
}

.mdate-day.today {
  border: 2px solid #38bdf8;
  color: #0284c7;
}

.mdate-day.selected {
  background: #0ea5e9;
  color: #ffffff !important;
  font-weight: 900;
}

.mdate-foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
}

.mdate-today-btn {
  border: none;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

body.dark-theme .modern-date-trigger,
body.dark-theme .modern-date-popover {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

body.dark-theme .mdate-head strong,
body.dark-theme .mdate-day {
  color: #e2e8f0;
}

body.dark-theme .mdate-nav {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-theme .mdate-day:hover {
  background: #0f172a;
  color: #38bdf8;
}

body.dark-theme .mdate-foot {
  border-color: #334155;
}

/* =========================================================================
   LIVE LESSON BELL TIMER + TIME BADGE IN SCHEDULE
   ========================================================================= */
.teacher-bell-card {
  border-radius: 16px;
  padding: 14px 18px;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
}

.teacher-bell-card.bell-live {
  background: linear-gradient(135deg, #ecfdf5 0%, #dcfce7 100%);
  border-color: #22c55e;
}

.teacher-bell-card.bell-before {
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
  border-color: #f59e0b;
}

.teacher-bell-card.bell-after {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #38bdf8;
}

.bell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.bell-top strong {
  font-size: 15px;
  font-weight: 900;
  color: #0f172a;
}

.bell-top span {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
}

.bell-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
  overflow: hidden;
}

.bell-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #0ea5e9);
  transition: width 0.4s ease;
}

.t-sched-time {
  font-size: 13px;
  font-weight: 900;
  color: #0369a1;
  text-align: center;
}

body.dark-theme .teacher-bell-card {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .teacher-bell-card.bell-live {
  background: rgba(34, 197, 94, 0.16);
  border-color: #22c55e;
}

body.dark-theme .teacher-bell-card.bell-before {
  background: rgba(245, 158, 11, 0.16);
  border-color: #f59e0b;
}

body.dark-theme .bell-top strong { color: #f1f5f9; }
body.dark-theme .bell-top span { color: #cbd5e1; }
body.dark-theme .t-sched-time { color: #7dd3fc; }

/* =========================================================================
   COLLAPSIBLE LEFT SIDEBAR + COMPACT TEACHER PANEL
   ========================================================================= */
.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sidebar-collapse-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0284c7;
}

.sidebar-expand-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 2px solid #cbd5e1;
  background: var(--duo-card-bg, #ffffff);
  color: var(--duo-text-dark, #1e293b);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sidebar-expand-btn:hover {
  border-color: #0ea5e9;
  background: #f0f9ff;
}

@media (min-width: 769px) {
  .left-sidebar {
    transition: transform 0.24s ease;
  }
  .main-wrapper {
    transition: margin-left 0.24s ease, max-width 0.24s ease;
  }
  body.sidebar-collapsed .left-sidebar {
    transform: translateX(-105%);
    pointer-events: none;
  }
  body.sidebar-collapsed .main-wrapper {
    margin-left: 0 !important;
    max-width: 100% !important;
  }
  body.sidebar-collapsed #sidebar-expand-btn {
    display: inline-flex;
  }
}

@media (max-width: 768px) {
  .sidebar-collapse-btn,
  .sidebar-expand-btn {
    display: none !important;
  }
}

body.dark-theme .sidebar-collapse-btn,
body.dark-theme .sidebar-expand-btn {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

/* Compact Teacher Panel */
#view-teacher.view-container {
  padding: 16px 22px !important;
}

#view-teacher .teacher-hero-banner {
  padding: 14px 20px;
  margin-bottom: 12px;
  border-radius: 18px;
}

#view-teacher .teacher-hero-banner h2 {
  font-size: 21px;
  margin: 2px 0;
}

#view-teacher .teacher-hero-banner p {
  font-size: 12.5px;
}

#view-teacher .teacher-stat-pill {
  padding: 7px 12px;
}

#view-teacher .teacher-tabs {
  gap: 6px;
  margin-bottom: 12px;
}

#view-teacher .teacher-tab-btn {
  padding: 7px 12px;
  font-size: 12.5px;
  border-radius: 12px;
}

#view-teacher .teacher-two-col {
  gap: 16px;
}

#view-teacher .teacher-form-card {
  padding: 16px 18px;
  border-radius: 16px;
}

#view-teacher .teacher-form-card h3,
#view-teacher .teacher-list-col h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

#view-teacher .teacher-label {
  margin: 7px 0 3px;
  font-size: 11px;
}

#view-teacher .teacher-input {
  padding: 8px 12px;
  font-size: 13px;
}

#view-teacher .teacher-item-card,
#view-teacher .teacher-student-card {
  padding: 12px 14px;
  border-radius: 14px;
}

#view-teacher .teacher-schedule-hero {
  padding: 14px 18px;
}

#view-teacher .t-sched-card {
  padding: 12px;
}

#view-teacher .att-topbar {
  padding: 12px 16px;
}

#view-teacher .att-row {
  padding: 9px 14px;
}

#view-teacher .wheel-stage-card {
  padding: 16px;
}

/* =========================================================================
   UNIT SENTENCES MODAL (20 ПРЕДЛОЖЕНИЙ НА КАЖДЫЙ РАЗДЕЛ)
   ========================================================================= */
.unit-sentences-window {
  max-width: 780px !important;
  width: 94%;
}

.unit-sent-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.unit-sent-list {
  padding: 14px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.unit-sent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 14px;
}

.unit-sent-num {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.unit-sent-text {
  flex: 1;
  min-width: 0;
}

.unit-sent-kz {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.4;
}

.unit-sent-ru {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}

body.dark-theme .unit-sent-toolbar {
  border-color: #334155;
}

body.dark-theme .unit-sent-row {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .unit-sent-kz {
  color: #f1f5f9;
}

body.dark-theme .unit-sent-ru {
  color: #94a3b8;
}

/* =========================================================================
   MORE MENU MODAL + CLEANER LESS-CLUTTERED MOBILE DESIGN
   ========================================================================= */
.more-section-block h4 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 900;
  color: var(--duo-text-dark, #0f172a);
}

.more-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 10px;
}

.more-nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 10px;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  border-bottom-width: 4px;
  background: #ffffff;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.more-nav-card:hover {
  border-color: #8b5cf6;
  transform: translateY(-2px);
}

.more-nav-icon {
  font-size: 26px;
}

.more-nav-card strong {
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
}

.more-empty-hint {
  font-size: 13px;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  padding: 12px 14px;
}

.more-pins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.more-pin-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
}

.more-pin-toggle.checked {
  border-color: #8b5cf6;
  background: #f5f3ff;
  color: #5b21b6;
}

body.dark-theme .more-nav-card,
body.dark-theme .more-pin-toggle {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-theme .more-nav-card strong {
  color: #f1f5f9;
}

body.dark-theme .more-pin-toggle.checked {
  background: rgba(139, 92, 246, 0.22);
  border-color: #8b5cf6;
  color: #ddd6fe;
}

body.dark-theme .more-empty-hint {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

/* Cleaner, Less-Cluttered Mobile Layout */
@media (max-width: 768px) {
  .left-sidebar {
    padding: 4px 6px !important;
    justify-content: space-around !important;
    height: 62px !important;
  }
  .left-sidebar .nav-links {
    display: flex !important;
    width: 100% !important;
    justify-content: space-around !important;
    gap: 2px !important;
  }
  .left-sidebar .nav-item {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 4px 2px !important;
    justify-content: center !important;
  }
  .left-sidebar .nav-item span:not(.nav-icon) {
    font-size: 9px !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 64px;
  }
  .right-sidebar {
    display: none !important;
  }
  .unit-banner {
    padding: 14px 16px !important;
    border-radius: 18px !important;
  }
  .unit-title {
    font-size: 17px !important;
  }
  .unit-desc {
    font-size: 12px !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .top-header .sound-toggle-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 15px !important;
    padding: 0 !important;
  }
  #view-teacher.view-container {
    padding: 10px 10px 84px !important;
  }
  #view-teacher .teacher-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  #view-teacher .teacher-tab-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
}

/* Fix scrolling in Справочник (#modal-textbook) for 20 sentences & other tabs */
#modal-textbook .modal-scroll-modern {
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Remove floating circular emoji badges next to avatar frames */
.duo-frame-preview::after,
.duo-profile-avatar-circle::after,
.header-avatar-frame::after {
  display: none !important;
  content: none !important;
}

/* Remove gray button border around header avatar button */
#header-user-btn,
body.dark-theme #header-user-btn {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
#header-user-btn:hover,
body.dark-theme #header-user-btn:hover {
  background: rgba(148, 163, 184, 0.14) !important;
}
.header-avatar-frame.frame-none {
  border: none !important;
}

/* Balanced mobile top-header spacing after removing sound & cheat-sheet buttons */
@media (max-width: 768px) {
  .top-header {
    padding: 0 12px !important;
    height: 56px !important;
  }
  .top-header .header-stats {
    gap: 8px !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  .top-header .header-stats .stat-item {
    flex: 1 1 0 !important;
    padding: 6px 8px !important;
    gap: 5px !important;
    font-size: 13px !important;
  }
  .top-header .sound-toggle-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 16px !important;
    flex-shrink: 0 !important;
  }
  .top-header #header-user-btn {
    padding: 4px 6px !important;
    gap: 6px !important;
    max-width: 112px !important;
    flex-shrink: 0 !important;
  }
}

/* ==========================================================================
   OLYMPIAD SECTION (ONLY FOR ANNA + TEACHER CHAT)
   ========================================================================== */
.olympiad-shell {
  max-width: 1060px;
  margin: 0 auto;
  padding: 16px 18px 80px;
}
.olympiad-hero {
  background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 55%, #ec4899 100%);
  color: #ffffff;
  border-radius: 22px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 10px 26px rgba(124, 58, 237, 0.25);
}
.olympiad-hero-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.6px;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.olympiad-hero h2 {
  margin: 0 0 6px;
  font-size: 22px;
}
.olympiad-hero p {
  margin: 0;
  font-size: 13px;
  opacity: 0.92;
}
.olympiad-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.olympiad-tab-btn {
  border: 2px solid var(--duo-gray-border);
  background: #ffffff;
  color: var(--duo-text-dark);
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}
.olympiad-tab-btn.active {
  background: #7c3aed;
  border-color: #6d28d9;
  color: #ffffff;
  box-shadow: 0 4px 0 #5b21b6;
}
.olympiad-chat-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 20px;
  padding: 16px;
}
.olympiad-chat-messages {
  height: 380px;
  overflow-y: auto;
  padding: 10px;
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.olympiad-chat-empty {
  text-align: center;
  color: var(--duo-gray-text);
  font-size: 13px;
  font-weight: 700;
  padding: 28px 16px;
}
.olympiad-msg-row {
  display: flex;
}
.olympiad-msg-row.me {
  justify-content: flex-end;
}
.olympiad-msg-row.other {
  justify-content: flex-start;
}
.olympiad-msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.45;
}
.olympiad-msg-bubble.me {
  background: #7c3aed;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.olympiad-msg-bubble.other {
  background: #ffffff;
  color: var(--duo-text-dark);
  border: 1.5px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}
.olympiad-msg-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  opacity: 0.85;
  margin-bottom: 4px;
}
.olympiad-msg-del {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.65;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  padding: 0 3px;
  line-height: 1;
}
.olympiad-msg-del:hover {
  opacity: 1;
}
.olympiad-chat-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.olympiad-chat-form .teacher-input {
  flex: 1;
  margin-bottom: 0;
}
.olympiad-books-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 16px;
  align-items: start;
}
.olympiad-books-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.olympiad-books-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.olympiad-book-item {
  text-align: left;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s ease;
}
.olympiad-book-item.active {
  border-color: #7c3aed;
  background: #f5f3ff;
}
.olympiad-book-item strong {
  font-size: 13px;
  color: var(--duo-text-dark);
}
.olympiad-book-item small {
  font-size: 11px;
  color: var(--duo-gray-text);
  line-height: 1.35;
}
.olympiad-book-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 900;
  color: #6d28d9;
  background: #ede9fe;
  padding: 2px 8px;
  border-radius: 999px;
}
.olympiad-book-reader {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 18px;
  padding: 16px;
}
.olympiad-reader-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.olympiad-reader-head h3 {
  margin: 4px 0 0;
  font-size: 17px;
}
.olympiad-pdf-frame-wrap {
  width: 100%;
  height: 640px;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid #e2e8f0;
  background: #f1f5f9;
}
.olympiad-pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.olympiad-interactive-book {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.olympiad-chapter-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
}
.olympiad-chapter-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #5b21b6;
}
.olympiad-chapter-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--duo-text-dark);
}
.olympiad-chapter-body ul, .olympiad-chapter-body ol {
  margin: 6px 0;
  padding-left: 20px;
}
.olympiad-rules-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.olympiad-rule-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.olympiad-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}
.olympiad-rule-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.olympiad-rule-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.olympiad-rule-cat {
  font-size: 11px;
  font-weight: 800;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 999px;
}
.olympiad-rule-lvl {
  font-size: 10px;
  font-weight: 900;
  color: #7c3aed;
  background: #ede9fe;
  padding: 2px 8px;
  border-radius: 999px;
}
.olympiad-rule-card h4 {
  margin: 0;
  font-size: 15px;
}
.olympiad-rule-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--duo-text-dark);
}
.olympiad-rule-ex {
  font-size: 12px;
  font-weight: 700;
  color: #065f46;
  background: #ecfdf5;
  border-radius: 10px;
  padding: 8px 10px;
}
body.dark-theme .olympiad-tab-btn,
body.dark-theme .olympiad-chat-card,
body.dark-theme .olympiad-book-item,
body.dark-theme .olympiad-book-reader,
body.dark-theme .olympiad-rule-card {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}
body.dark-theme .olympiad-chat-messages,
body.dark-theme .olympiad-chapter-card,
body.dark-theme .olympiad-msg-bubble.other {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}
body.dark-theme .olympiad-book-item.active {
  background: rgba(124, 58, 237, 0.2);
}
body.dark-theme .olympiad-chapter-body,
body.dark-theme .olympiad-rule-body,
body.dark-theme .olympiad-book-item strong {
  color: #e2e8f0;
}
body.dark-theme .olympiad-rule-ex {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}
@media (max-width: 768px) {
  .olympiad-books-layout {
    grid-template-columns: 1fr;
  }
  .olympiad-pdf-frame-wrap {
    height: 460px;
  }
  .olympiad-rules-grid {
    grid-template-columns: 1fr;
  }
}

/* Wider Olympiad PDF reader on desktop (moderate size) & full-width on mobile */
@media (min-width: 769px) {
  .left-sidebar,
  .left-sidebar .nav-links {
    overflow-x: hidden !important;
  }
  .olympiad-shell {
    max-width: 1180px !important;
  }
  .olympiad-books-layout {
    grid-template-columns: 245px 1fr !important;
  }
  .olympiad-pdf-frame-wrap {
    height: 640px !important;
  }
}

@media (max-width: 768px) {
  .left-sidebar,
  .left-sidebar .nav-links {
    overflow-x: hidden !important;
  }
  .olympiad-shell {
    padding: 8px 6px 84px !important;
  }
  .olympiad-book-reader {
    padding: 10px 8px !important;
  }
  .olympiad-pdf-frame-wrap {
    height: calc(100dvh - 190px) !important;
    min-height: 440px !important;
  }
}

/* Dark theme fixes for inputs, text frames, Olympiad cards & Teacher builder */
body.dark-theme input[type="url"],
body.dark-theme input[type="email"],
body.dark-theme input[type="search"],
body.dark-theme .olympiad-chat-form .teacher-input,
body.dark-theme .olympiad-rules-toolbar .teacher-input {
  background-color: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .olympiad-chat-card,
body.dark-theme .olympiad-book-reader,
body.dark-theme .olympiad-book-item,
body.dark-theme .olympiad-rule-card,
body.dark-theme .builder-line-box {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .olympiad-pdf-frame-wrap {
  background: #0f172a !important;
  border-color: #2b3f4a !important;
}
body.dark-theme .olympiad-reader-head h3,
body.dark-theme .olympiad-rule-card h4,
body.dark-theme .olympiad-book-item strong {
  color: #f1f5f9 !important;
}
body.dark-theme .olympiad-book-item small,
body.dark-theme .olympiad-chat-empty {
  color: #94a3b8 !important;
}
body.dark-theme .olympiad-rule-cat {
  background: rgba(14, 165, 233, 0.2) !important;
  color: #7dd3fc !important;
}
body.dark-theme .olympiad-rule-lvl,
body.dark-theme .olympiad-book-badge {
  background: rgba(139, 92, 246, 0.25) !important;
  color: #ddd6fe !important;
}
body.dark-theme .olympiad-rule-body code {
  background: rgba(139, 92, 246, 0.25) !important;
  color: #e9d5ff !important;
  padding: 1px 5px;
  border-radius: 4px;
}
body.dark-theme .builder-narrators-box {
  background: rgba(139, 92, 246, 0.14) !important;
  border-color: rgba(139, 92, 246, 0.35) !important;
}

/* Dark theme fixes for Clans (chat messages, inputs, modals, text boxes) */
body.dark-theme .auth-input,
body.dark-theme .clan-chat-form .auth-input,
body.dark-theme .clan-search-box .duo-input,
body.dark-theme #view-clans .duo-input,
body.dark-theme .clan-modal-window .duo-input {
  background-color: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .clan-chat-msg {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
}
body.dark-theme .clan-chat-msg.mine {
  background: rgba(16, 185, 129, 0.16) !important;
  border-color: #10b981 !important;
}
body.dark-theme .clan-chat-text {
  color: #f1f5f9 !important;
}
body.dark-theme .clan-chat-meta {
  color: #94a3b8 !important;
}
body.dark-theme .clan-modal-window,
body.dark-theme .clan-tab-btn {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .clan-tab-btn.active {
  background: #1cb0f6 !important;
  border-color: #1899d6 !important;
  color: #ffffff !important;
}
body.dark-theme .clan-stat-item,
body.dark-theme .clan-large-emblem {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .clan-stat-item strong {
  color: #f8fafc !important;
}
body.dark-theme .clan-roster-table .roster-username,
body.dark-theme .clan-roster-table .roster-rank-col,
body.dark-theme .clan-roster-table .roster-xp-col {
  color: #f1f5f9 !important;
}
body.dark-theme .role-badge.role-member {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #cbd5e1 !important;
}
body.dark-theme .role-badge.role-leader {
  background: rgba(250, 204, 21, 0.16) !important;
  border-color: #eab308 !important;
  color: #fde047 !important;
}

/* Dark theme fixes for Attendance (Перекличка класса) */
body.dark-theme .att-topbar,
body.dark-theme .att-row {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .att-topbar h3,
body.dark-theme .att-student-info strong {
  color: #f1f5f9 !important;
}
body.dark-theme .att-topbar p,
body.dark-theme .att-student-info small {
  color: #94a3b8 !important;
}
body.dark-theme .att-num {
  background: rgba(14, 165, 233, 0.2) !important;
  color: #7dd3fc !important;
}
body.dark-theme .att-stat-pill {
  background: #131f24 !important;
  color: #e2e8f0 !important;
  border: 1px solid #2b3f4a;
}
body.dark-theme .att-stat-pill.att-present {
  background: rgba(34, 197, 94, 0.18) !important;
  color: #86efac !important;
  border-color: rgba(34, 197, 94, 0.35);
}
body.dark-theme .att-stat-pill.att-sick {
  background: rgba(14, 165, 233, 0.18) !important;
  color: #7dd3fc !important;
  border-color: rgba(14, 165, 233, 0.35);
}
body.dark-theme .att-stat-pill.att-absent {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35);
}
body.dark-theme .att-btn {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #cbd5e1 !important;
}
body.dark-theme .att-btn.att-present.active {
  background: #22c55e !important;
  border-color: #16a34a !important;
  color: #ffffff !important;
}
body.dark-theme .att-btn.att-sick.active {
  background: #0ea5e9 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
}
body.dark-theme .att-btn.att-absent.active {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

/* Blocked weekends & Mondays in modern calendar date picker */
.mdate-day.disabled,
.mdate-day:disabled {
  opacity: 0.34 !important;
  cursor: not-allowed !important;
  text-decoration: line-through;
  background: transparent !important;
  color: #94a3b8 !important;
  pointer-events: auto !important;
}
.mdate-day.disabled:hover {
  transform: none !important;
  background: transparent !important;
}
.mdate-today-btn:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
}

/* Dark theme fixes for Friend DM Chat (#modal-friend-dm) */
.dm-chat-form {
  background: #ffffff;
}
body.dark-theme .dm-chat-scroll {
  background: #131f24 !important;
  color: #f1f5f9 !important;
}
body.dark-theme .dm-chat-form,
body.dark-theme .dm-presets-section {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme #modal-friend-dm .dm-modal-header div {
  color: #f1f5f9 !important;
}
body.dark-theme #modal-friend-dm .modal-close-btn {
  color: #cbd5e1 !important;
  background: #131f24 !important;
  border-color: #2b3f4a !important;
}

/* Dark theme fixes for Teacher Students List */
body.dark-theme .teacher-student-card {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .teacher-student-name {
  color: #f1f5f9 !important;
}
body.dark-theme .teacher-student-sub {
  color: #94a3b8 !important;
}
body.dark-theme .teacher-student-metrics span {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #e2e8f0 !important;
}
body.dark-theme .teacher-avg-pill {
  background: rgba(56, 189, 248, 0.18) !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
}
body.dark-theme .act-summary-pill,
body.dark-theme .teacher-act-pill {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #cbd5e1 !important;
}
body.dark-theme .act-summary-pill.act-today,
body.dark-theme .teacher-act-pill.act-today {
  background: rgba(34, 197, 94, 0.16) !important;
  color: #86efac !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
}
body.dark-theme .act-summary-pill.act-stale,
body.dark-theme .teacher-act-pill.act-stale {
  background: rgba(239, 68, 68, 0.16) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
body.dark-theme .teacher-act-pill.act-recent {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fde68a !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

/* Dark theme fix for Friend Remove (✕) button & Clan Info modal */
body.dark-theme .duo-friend-remove {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #cbd5e1 !important;
}
body.dark-theme .duo-friend-remove:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}
body.dark-theme #modal-clan-info .modal-window {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme #modal-clan-info .duo-friend-row {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
}

/* Dark theme fix for Welcome / Auth screen */
body.dark-theme .welcome-badge {
  background: #131f24 !important;
  border: 2px solid #2b3f4a !important;
  color: #7dd3fc !important;
}
body.dark-theme .welcome-subtitle {
  color: #cbd5e1 !important;
}
body.dark-theme .welcome-back-btn {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .welcome-bar-title {
  color: #f1f5f9 !important;
}

/* Welcome avatar grid (3x4 for 12 avatars) & mobile single-scroll fix */
#welcome-avatar-picker-grid.auth-avatar-grid {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 768px) {
  #welcome-avatar-picker-grid.auth-avatar-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .auth-welcome-screen {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .auth-welcome-screen .welcome-pane.active {
    overflow: visible !important;
    height: auto !important;
  }
  .auth-welcome-screen .welcome-form-card {
    margin-bottom: 28px !important;
  }
}

/* Complete dark-theme coverage across all games, SOR, textbook modal, chatbot & empty cards */
.auth-server-status-box,
#kz-tutor-key-bar {
  background: #f8fafc;
}
body.dark-theme .auth-server-status-box,
body.dark-theme #kz-tutor-key-bar,
body.dark-theme .league-empty-card,
body.dark-theme .tetris-stat,
body.dark-theme .sor-option-btn,
body.dark-theme .sor-write-input,
body.dark-theme .sor-kz-key,
body.dark-theme .sor-order-slots,
body.dark-theme .sor-match-btn,
body.dark-theme .tb-nav-modern,
body.dark-theme .tb-vocab-search,
body.dark-theme .pdf-reader-icon,
body.dark-theme .book-grade-badge {
  background: #1b2a32 !important;
  background-color: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .sor-opt-letter,
body.dark-theme .modal-close-modern,
body.dark-theme .duo-frame-lock {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #e2e8f0 !important;
}
body.dark-theme .sor-option-btn:hover,
body.dark-theme .sor-match-btn:hover,
body.dark-theme .sor-kz-key:hover {
  background: #243640 !important;
  border-color: #38bdf8 !important;
}
body.dark-theme .kz-map-pin-dot {
  background: #1b2a32 !important;
  border-color: #38bdf8 !important;
}
body.dark-theme .kz-region-trail {
  background: #131f24 !important;
}

/* ==========================================================================
   BOSS BATTLE ARENA (БОЙ С БОССОМ)
   ========================================================================== */
.boss-lobby-hero {
  background: linear-gradient(135deg, #3b0764 0%, #6d28d9 50%, #be123c 100%);
  color: #ffffff;
  border-radius: 22px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  box-shadow: 0 10px 28px rgba(109, 40, 217, 0.28);
}
.boss-badge-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.boss-lobby-hero h2 { margin: 0 0 6px; font-size: 22px; }
.boss-lobby-hero p { margin: 0; font-size: 13px; opacity: 0.92; }
.boss-hero-icon { font-size: 56px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35)); }

.boss-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}
.boss-select-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.boss-card-banner {
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.boss-card-emoji {
  font-size: 56px;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35));
}
.boss-defeated-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(16, 185, 129, 0.92);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 999px;
}
.boss-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.boss-card-body h3 { margin: 0; font-size: 16px; }
.boss-card-body p { margin: 0; font-size: 12px; color: var(--duo-gray-text); }
.boss-card-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  margin: 6px 0 8px;
}

.boss-arena {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.boss-arena-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.boss-player-hud {
  display: flex;
  align-items: center;
  gap: 10px;
}
.boss-hearts { font-size: 20px; letter-spacing: 2px; }
.boss-combo-pill {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}
.boss-stage {
  border-radius: 22px;
  padding: 18px 20px;
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.boss-hp-wrap {
  width: 100%;
  max-width: 560px;
}
.boss-hp-head {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 900;
  margin-bottom: 6px;
}
.boss-hp-track {
  height: 16px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.25);
}
.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #fde047);
  border-radius: 999px;
  transition: width 0.35s ease;
}
@keyframes bossFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes bossShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px) rotate(-4deg); }
  75% { transform: translateX(10px) rotate(4deg); }
}
.boss-sprite {
  font-size: 84px;
  line-height: 1;
  animation: bossFloat 2.6s ease-in-out infinite;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45));
}
.boss-arena.boss-hit .boss-sprite,
.boss-arena.boss-ult .boss-sprite {
  animation: bossShake 0.35s ease;
}
.boss-battle-log {
  background: rgba(0, 0, 0, 0.28);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  width: 100%;
  max-width: 620px;
}
.boss-controls-card,
.boss-result-card {
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 20px;
  padding: 18px;
}
.boss-result-card { text-align: center; }
.boss-q-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.boss-q-text {
  font-size: 17px;
  font-weight: 900;
  flex: 1;
}
.boss-ult-btn {
  border: 2px solid #cbd5e1;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 900;
  cursor: not-allowed;
}
.boss-ult-btn.ready {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-color: #b91c1c;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
}
.boss-opts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.boss-opt-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--duo-gray-border);
  border-bottom-width: 4px;
  background: #ffffff;
  color: var(--duo-text-dark);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.boss-opt-btn:hover {
  border-color: #7c3aed;
  transform: translateY(-1px);
}
.boss-opt-letter {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #ede9fe;
  color: #5b21b6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .boss-opts-grid { grid-template-columns: 1fr; }
  .boss-sprite { font-size: 68px; }
}
body.dark-theme .boss-select-card,
body.dark-theme .boss-controls-card,
body.dark-theme .boss-result-card,
body.dark-theme .boss-opt-btn {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .boss-card-body h3,
body.dark-theme .boss-q-text { color: #f1f5f9 !important; }
body.dark-theme .boss-card-body p { color: #94a3b8 !important; }
body.dark-theme .boss-opt-letter {
  background: rgba(139, 92, 246, 0.25) !important;
  color: #ddd6fe !important;
}
body.dark-theme .boss-ult-btn:not(.ready) {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #64748b !important;
}

/* Enhanced SOR/SOCH Simulator UI + Dark Theme */
.sor-best-badge {
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 10px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.sor-best-badge small { font-size: 11px; font-weight: 800; opacity: 0.9; }
.sor-best-badge strong { font-size: 24px; font-weight: 900; line-height: 1.1; }
.sor-best-badge span { font-size: 11px; font-weight: 700; opacity: 0.85; }
.sor-card-top-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}
.sor-history-card {
  margin-top: 18px;
  background: #ffffff;
  border: 2px solid var(--duo-gray-border);
  border-radius: 18px;
  padding: 16px;
}
.sor-history-card h4 { margin: 0 0 10px; font-size: 15px; font-weight: 900; }
.sor-history-list { display: flex; flex-direction: column; gap: 8px; }
.sor-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  font-size: 13px;
}
.sor-hist-grade {
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 11px;
}
.sor-hist-grade.g5 { background: #dcfce7; color: #15803d; }
.sor-hist-grade.g4 { background: #e0f2fe; color: #0369a1; }
.sor-hist-grade.g3 { background: #fef3c7; color: #b45309; }
.sor-hint-box {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  color: #92400e;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}
.sor-timer-pill.urgent {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #ef4444 !important;
}
body.dark-theme .sor-history-card,
body.dark-theme .sor-result-card {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .sor-history-row {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #e2e8f0 !important;
}
body.dark-theme .sor-hint-box {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fde68a !important;
}

/* ==========================================================================
   CHESS WITH FRIENDS (#modal-friend-chess) — CHESS.COM STYLE
   ========================================================================== */
.chess-modal-window {
  max-width: 460px !important;
  width: 96vw !important;
  padding: 0 !important;
  overflow: hidden !important;
}
.chess-player-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  font-size: 13px;
  background: #f8fafc;
  color: #334155;
  border-bottom: 1.5px solid #e2e8f0;
}
.chess-player-strip.active-turn {
  background: #f0fdf4;
}
.chess-status-pill {
  font-size: 11.5px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}
.chess-status-pill.my-turn {
  background: #22c55e;
  color: #ffffff;
}
.chess-board-wrap {
  padding: 14px;
  display: flex;
  justify-content: center;
  background: linear-gradient(145deg, #2d2a26 0%, #1e1c1a 100%);
}
.chess-top-header {
  padding: 12px 16px !important;
  border-bottom: 2px solid var(--duo-gray-border);
}
.chess-header-emblem {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #769656, #4b7333);
  color: #ffffff;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}
.chess-player-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chess-color-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1.5px solid #cbd5e1;
}
.chess-color-badge.wht {
  background: #ffffff;
  color: #1e293b;
}
.chess-color-badge.blk {
  background: #262421;
  color: #f8fafc;
  border-color: #475569;
}
.chess-cap-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
  min-height: 16px;
}
.chess-cap-mini {
  width: 15px;
  height: 15px;
  display: inline-flex;
}
.chess-cap-mini .chess-svg-piece {
  width: 100%;
  height: 100%;
}
.chess-cap-adv {
  font-size: 11px;
  font-weight: 900;
  color: #16a34a;
  margin-left: 4px;
}
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  border: 2px solid #3c3a36;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
}
.chess-sq {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.chess-sq.light { background: #eeeed2; color: #769656; }
.chess-sq.dark { background: #769656; color: #eeeed2; }
.chess-sq.last-move.light { background: #f6f669; }
.chess-sq.last-move.dark { background: #baca2b; }
.chess-sq.selected.light,
.chess-sq.selected.dark { background: #f6f669 !important; }
.chess-sq.in-check {
  background: radial-gradient(circle, #ef4444 0%, #b91c1c 75%) !important;
}
.chess-coord-rank {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  opacity: 0.82;
  pointer-events: none;
}
.chess-coord-file {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  opacity: 0.82;
  pointer-events: none;
}
.chess-svg-piece {
  width: 84%;
  height: 84%;
  display: block;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}
.chess-dot {
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  pointer-events: none;
  z-index: 3;
}
.chess-capture-ring {
  position: absolute;
  width: 86%;
  height: 86%;
  border-radius: 50%;
  border: 4px solid rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 3;
}
body.dark-theme .chess-modal-window {
  background: #1b2a32 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .chess-player-strip {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #e2e8f0 !important;
}
body.dark-theme .chess-player-strip.active-turn {
  background: rgba(34, 197, 94, 0.14) !important;
}
body.dark-theme .chess-status-pill {
  background: #1b2a32 !important;
  color: #cbd5e1 !important;
}
body.dark-theme .chess-status-pill.my-turn {
  background: #22c55e !important;
  color: #ffffff !important;
}

/* Complete Dark Theme for SOR/SOCH & Express Training */
body.dark-theme .sor-passage-box {
  background: #131f24 !important;
  border-color: #6366f1 !important;
  color: #f1f5f9 !important;
}
body.dark-theme .sor-question-text,
body.dark-theme .sor-exam-top h3,
body.dark-theme .sor-choice-card h3 {
  color: #f1f5f9 !important;
}
body.dark-theme .sor-choice-card p {
  color: #94a3b8 !important;
}
body.dark-theme .sor-write-input,
body.dark-theme .sor-write-input:focus {
  background: #131f24 !important;
  background-color: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #f1f5f9 !important;
}
body.dark-theme .sor-write-input:focus {
  border-color: #10b981 !important;
}
body.dark-theme .sor-sec-badge {
  background: rgba(139, 92, 246, 0.25) !important;
  color: #ddd6fe !important;
}
body.dark-theme .sor-timer-pill {
  background: rgba(245, 158, 11, 0.18) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #fde68a !important;
}
body.dark-theme .sor-nav-pill {
  background: #131f24 !important;
  border-color: #2b3f4a !important;
  color: #cbd5e1 !important;
}
body.dark-theme .sor-nav-pill.answered {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
}
body.dark-theme .sor-nav-pill.current {
  background: rgba(59, 130, 246, 0.25) !important;
  border-color: #3b82f6 !important;
  color: #93c5fd !important;
}
body.dark-theme .sor-option-btn.selected,
body.dark-theme .sor-match-btn.selected {
  background: rgba(59, 130, 246, 0.22) !important;
  border-color: #38bdf8 !important;
  color: #f1f5f9 !important;
}
body.dark-theme .sor-match-btn.paired,
body.dark-theme .sor-word-chip.placed {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
}
body.dark-theme .sor-grade-pill {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #6ee7b7 !important;
}
body.dark-theme .sor-review-row.ok {
  background: rgba(16, 185, 129, 0.14) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #e2e8f0 !important;
}
body.dark-theme .sor-review-row.bad {
  background: rgba(239, 68, 68, 0.14) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #e2e8f0 !important;
}
body.dark-theme .sor-card-top-pill {
  background: rgba(139, 92, 246, 0.24) !important;
  color: #e9d5ff !important;
}

/* Chess Setup Side Picker & Victory Animation */
.chess-setup-body {
  padding: 20px 18px 22px;
}
.chess-setup-body h4 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 900;
  color: var(--duo-text-dark);
}
.chess-color-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.chess-side-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: 16px;
  border: 2px solid var(--duo-gray-border);
  background: var(--duo-card-bg);
  color: var(--duo-text-dark);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.chess-side-btn:hover {
  transform: translateY(-2px);
  border-color: #8b5cf6;
}
.chess-side-btn.active {
  border-color: #7c3aed;
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 4px 0 #7c3aed;
}
.chess-side-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chess-side-btn strong {
  font-size: 13.5px;
  font-weight: 900;
}
.chess-side-btn small {
  font-size: 11px;
  font-weight: 700;
  color: var(--duo-gray-text);
}

.chess-victory-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  border-radius: 10px;
  animation: chessOverlayFade 0.28s ease-out;
}
.chess-victory-overlay.win {
  background: radial-gradient(circle at center, rgba(250, 204, 21, 0.28), rgba(15, 23, 42, 0.68));
}
.chess-victory-card {
  background: var(--duo-card-bg, #ffffff);
  color: var(--duo-text-dark, #1e293b);
  border: 2px solid rgba(250, 204, 21, 0.7);
  border-radius: 20px;
  padding: 20px 24px;
  text-align: center;
  max-width: 280px;
  width: 100%;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), 0 0 28px rgba(250, 204, 21, 0.32);
  animation: chessCardPop 0.36s cubic-bezier(0.22, 1.28, 0.36, 1);
}
.chess-victory-overlay.end .chess-victory-card {
  border-color: var(--duo-gray-border, #cbd5e1);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.chess-victory-crown {
  font-size: 46px;
  line-height: 1;
  margin-bottom: 8px;
  display: inline-block;
  animation: chessCrownPop 1.4s ease-in-out infinite;
}
.chess-victory-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 900;
}
.chess-victory-card p {
  margin: 0 0 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--duo-gray-text, #64748b);
}
@keyframes chessOverlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes chessCardPop {
  0% { opacity: 0; transform: scale(0.76) translateY(14px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes chessCrownPop {
  0%, 100% { transform: translateY(0) scale(1) rotate(-3deg); }
  50% { transform: translateY(-6px) scale(1.12) rotate(3deg); }
}

body.dark-theme .chess-side-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}
body.dark-theme .chess-side-btn.active {
  background: rgba(139, 92, 246, 0.24);
  border-color: #a78bfa;
  box-shadow: 0 4px 0 #6d28d9;
}
body.dark-theme .chess-victory-card {
  background: #1e293b;
  color: #f8fafc;
}
body.dark-theme .chess-victory-card p {
  color: #94a3b8;
}
