/* =========================================================================
   Eva Mobile — раздел «Учить» (Фаза 2). Загружается ПОСЛЕ mobile.css.
   Использует токены дизайн-системы Eva (--m-accent, --m-surface, --text-*,
   --input-border, --m-shadow-*) и сам переключается со светлой/тёмной темой.
   Префикс .lrn- изолирует стили от донорского style.css.
   ========================================================================= */

/* ---- Под-навигация раздела (4 сегмента) ---- */
.lrn-subnav {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  padding: 10px 12px 8px;
}
.lrn-tab {
  flex: 1;
  min-height: 48px;            /* mobile touch-target standard */
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--sidebar-item-hover);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 9px 0;
  border-radius: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s, background 0.18s, box-shadow 0.18s;
}
.lrn-tab.is-active {
  color: #fff;
  background: var(--m-accent-grad);
  box-shadow: var(--m-shadow-pop);
}

/* ---- Контейнер под-разделов ---- */
.lrn-view {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 18px;
}
.lrn-view.is-active {
  display: flex;
}

/* ---- Общие элементы ---- */
.lrn-btn {
  border: none;
  background: var(--m-accent-grad);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: var(--m-shadow-pop);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s;
}
.lrn-btn:active {
  transform: scale(0.96);
}
.lrn-btn.block {
  width: 100%;
}
.lrn-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.8;
}
.lrn-es-icon {
  font-size: 2.6rem;
  line-height: 1;
}

/* Состояния-заглушки (пусто / готово / оверлей) — центрированные блоки. */
.lrn-state-box {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 30px 24px;
}
.lrn-state-box h3 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--text-main);
}
.lrn-state-box p {
  margin: 0;
  max-width: 300px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.lrn-empty-mini {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 30px 16px;
}

/* =========================== УЧИТЬ =========================== */
#lrn-study .lrn-study-main { display: none; }
#lrn-study[data-state="card"] .lrn-study-main { display: flex; flex: 1; flex-direction: column; min-height: 0; }
#lrn-study[data-state="empty"] #lrn-study-empty { display: flex; }
#lrn-study[data-state="done"] #lrn-done { display: flex; }

.lrn-study-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.lrn-dir {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--sidebar-item-hover);
  border-radius: 14px;
}
.lrn-dir button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 11px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lrn-dir button.is-active {
  background: var(--m-surface);
  color: var(--m-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}
.lrn-counts {
  display: flex;
  gap: 14px;
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 600;
}
.lrn-cnt b {
  color: var(--text-main);
  font-size: 1.1rem;
}

.lrn-prog {
  height: 6px;
  background: var(--sidebar-item-hover);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 14px;
}
.lrn-prog span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--m-accent-grad);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* Карточка с 3D-флипом — фиксированная компактная высота, прижата к верху
   (сразу под прогресс-баром); нижняя панель остаётся внизу (margin-top:auto). */
.lrn-card-scene {
  flex: 0 0 auto;
  height: clamp(190px, 38vh, 300px);
  margin-bottom: 14px;
  perspective: 1400px;
  cursor: pointer;
}
.lrn-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.lrn-card-inner.flipped { transform: rotateY(180deg); }
.lrn-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
  border-radius: 26px;
  background: var(--m-surface);
  border: 1px solid var(--input-border);
  box-shadow: var(--m-shadow-soft);
}
.lrn-face.back { transform: rotateY(180deg); }
.lrn-ftag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--m-accent);
  text-transform: uppercase;
}
.lrn-word {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}
.lrn-ex {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.45;
  max-width: 90%;
}
.lrn-hot {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 1.1rem;
}

/* Нижняя панель: оценки / пропуск */
.lrn-bottom {
  flex: 0 0 auto;
  margin-top: auto;          /* pin rate buttons / skip to the bottom */
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.lrn-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}
.lrn-act {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--input-border);
  background: var(--m-surface);
  color: var(--text-main);
  font-size: 1.3rem;
  font-weight: 700;
  padding: 10px 0 8px;
  border-radius: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s;
}
.lrn-act:active { transform: scale(0.95); }
.lrn-act small { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.lrn-act.hard { color: #ef4444; }
.lrn-act.good { color: #f59e0b; }
.lrn-act.easy { color: #22c55e; }
.lrn-skip {
  width: 100%;
  min-height: 48px;            /* mobile touch-target standard */
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 14px;
  cursor: pointer;
}

/* Финал сессии */
.lrn-done-row {
  display: flex;
  gap: 12px;
  margin: 4px 0;
}
.lrn-done-row > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--m-surface);
  border: 1px solid var(--input-border);
  border-radius: 14px;
  padding: 12px 18px;
}
.lrn-done-row b { font-size: 1.4rem; color: var(--text-main); }
.lrn-done-row span { font-size: 0.74rem; color: var(--text-muted); }

/* =========================== ГЛУБОКО =========================== */
#lrn-deep .lrn-deep-main { display: none; }
#lrn-deep[data-state="card"] .lrn-deep-main { display: flex; flex: 1; flex-direction: column; min-height: 0; }
#lrn-deep[data-state="loading"] #lrn-deep-loading { display: flex; }
#lrn-deep[data-state="overlay"] #lrn-deep-overlay { display: flex; }

.lrn-deep-head { margin-bottom: 12px; }
#lrn-deep-progress {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.lrn-deep-stepbar { display: flex; gap: 6px; }
.lrn-deep-dot {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: var(--sidebar-item-hover);
  transition: background 0.25s;
}
.lrn-deep-dot.passed { background: var(--m-accent); opacity: 0.55; }
.lrn-deep-dot.active { background: var(--m-accent); }

.lrn-deep-card {
  flex: 1 1 auto;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 26px;
  margin-bottom: 14px;
  border-radius: 26px;
  background: var(--m-surface);
  border: 1px solid var(--input-border);
  box-shadow: var(--m-shadow-soft);
  cursor: pointer;
}
.lrn-deep-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--m-accent);
}
.lrn-deep-en {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  line-height: 1.35;
}
.lrn-deep-ru {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}
.lrn-deep-ru.show { max-height: 200px; opacity: 1; }

.lrn-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--sidebar-item-hover);
  border-top-color: var(--m-accent);
  border-radius: 50%;
  animation: lrn-spin 0.8s linear infinite;
}
@keyframes lrn-spin { to { transform: rotate(360deg); } }

/* =========================== СЛОВА =========================== */
.lrn-words-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
#lrn-words-ct { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }
.lrn-pill {
  border: 1px solid var(--input-border);
  background: var(--m-surface);
  color: var(--m-accent);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lrn-add-form {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: var(--m-surface);
  border: 1px solid var(--input-border);
  box-shadow: var(--m-shadow-soft);
}
.lrn-add-form.open { display: flex; }
.lrn-add-form input,
.lrn-search input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--input-border);
  background: var(--m-app-bg);
  color: var(--text-main);
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: 12px;
  outline: none;
}
.lrn-add-form input:focus,
.lrn-search input:focus { border-color: var(--m-accent); }
.lrn-in-row { display: flex; gap: 8px; }
.lrn-in-row input { flex: 1; }
.lrn-gen {
  flex: 0 0 auto;
  width: 44px;
  border: 1px solid rgba(125, 42, 232, 0.25);
  background: rgba(125, 42, 232, 0.1);
  color: var(--m-accent);
  font-size: 1.1rem;
  border-radius: 12px;
  cursor: pointer;
}
.lrn-gen.loading { opacity: 0.5; pointer-events: none; }
.lrn-search { margin-bottom: 10px; }

.lrn-word-list { display: flex; flex-direction: column; gap: 6px; }
.lrn-word-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--m-surface);
  border: 1px solid var(--input-border);
}
.lrn-word-score {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
}
.lrn-word-score.new { background: #94a3b8; }
.lrn-word-score.mid { background: #f59e0b; }
.lrn-word-score.strong { background: #22c55e; }
.lrn-word-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.lrn-word-en { font-size: 0.97rem; font-weight: 600; color: var(--text-main); }
.lrn-word-ru { font-size: 0.85rem; color: var(--text-muted); }
.lrn-word-del {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
}
.lrn-word-del:active { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

/* =========================== ПРОГРЕСС =========================== */
.lrn-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.lrn-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  border-radius: 18px;
  background: var(--m-surface);
  border: 1px solid var(--input-border);
  box-shadow: var(--m-shadow-soft);
}
.lrn-stat b {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.lrn-stat span { font-size: 0.78rem; color: var(--text-muted); }

.lrn-card-soft {
  padding: 16px;
  border-radius: 18px;
  background: var(--m-surface);
  border: 1px solid var(--input-border);
  box-shadow: var(--m-shadow-soft);
  margin-bottom: 12px;
}
.lrn-soft-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
}
.lrn-heatmap {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 5px;
}
.lrn-hm-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--sidebar-item-hover);
}
.lrn-hm-cell.lvl-1 { background: rgba(125, 42, 232, 0.55); }
.lrn-hm-cell.lvl-2 { background: var(--m-accent); }

.lrn-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.lrn-bar:last-child { margin-bottom: 0; }
.lrn-bar-lbl {
  flex: 0 0 64px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}
.lrn-bar-track {
  flex: 1 1 auto;
  height: 8px;
  background: var(--sidebar-item-hover);
  border-radius: 99px;
  overflow: hidden;
}
.lrn-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.lrn-bar-fill.new { background: #94a3b8; }
.lrn-bar-fill.mid { background: #f59e0b; }
.lrn-bar-fill.strong { background: #22c55e; }
.lrn-bar-num {
  flex: 0 0 auto;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 20px;
  text-align: right;
}

/* =========================== Тосты =========================== */
.lrn-toast {
  background: var(--m-surface);
  color: var(--text-main);
  border: 1px solid var(--input-border);
  box-shadow: var(--m-shadow-soft);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 0.9rem;
  margin-top: 8px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
}
.lrn-toast.show { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .lrn-card-inner,
  .lrn-deep-ru,
  .lrn-toast,
  .lrn-bar-fill,
  .lrn-prog span { transition: none; }
  .lrn-spinner { animation: none; }
}
