/* _coreminiapp/app/assets/css/app.css
   Главный фронт (index.html): шапка, вкладки, уроки, библиотека, портал, тренажёр, профиль.
   Цвета — из Telegram Theme (--tg-theme-*), с fallback на светлую тему. */

:root {
  --bg:        var(--tg-theme-bg-color, #ffffff);
  --bg2:       var(--tg-theme-secondary-bg-color, #f2f2f7);
  --text:      var(--tg-theme-text-color, #1c1c1e);
  --hint:      var(--tg-theme-hint-color, #8e8e93);
  --link:      var(--tg-theme-link-color, #1e88e5);
  --btn:       var(--tg-theme-button-color, #1e88e5);
  --btn-text:  var(--tg-theme-button-text-color, #ffffff);
  --danger:    #e53935;
  --ok:        #34c759;
  --warn:      #ff9f0a;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --border:    1px solid rgba(0,0,0,.06);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0px 16px 96px !important;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ Шапка и вкладки ============ */
.modules-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0 12px;
  border-bottom: none;
  margin-bottom: 0;
 /* border:1px solid red;*/
}
.modules-header h1 {
  font-size:24px!important;;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
/*#user-profile-btn {
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d0d0d5;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background .1s;
}*/
#user-profile-btn {
  padding: 6px 10px;
  background: #fff;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background .1s;
}
.read {color:dimgray; font-weight:normal!important}

#user-profile-btn:hover { background: #f8f8fb; }
#user-profile-name { font-size: .95rem; opacity: 1; }
.admin-link {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    background: #ffcc00;
    color: #000;
    text-decoration: none;
    border: 0px solid red;
    white-space: nowrap;
}

/*.admin-link {
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d0d0d5;
  font-size: .9rem;
  font-weight: 500;
}

.app-tabs {
  background-color:rgb(244, 244, 245);  
  background-attachment:scroll
}
.app-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 5px;
  margin-bottom: 5px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.app-tabs::-webkit-scrollbar { display: none; }

.app-tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #d0d0d5;
  background: #fff;
  color: #1c1c1e;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 400;
  transition: background .1s, border-color .1s, color .1s;
  white-space: nowrap;
}
.app-tab:hover { background: #f8f8fb; }
.app-tab.active {
  background: #0a84ff;
  border-color: #0a84ff;
  color: #fff;
  font-weight: 500;
}*/

.app-tabs {
  display: flex;
  gap: 2px;
  background: var(--tg-theme-secondary-bg-color, #e5e5ea);
  padding: 3px;
  border-radius: 10px;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.app-tabs::-webkit-scrollbar {
  display: none;
}
.app-tabs .app-tab {
  flex: 0 0 auto;
  padding: 8px 6px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--tg-theme-text-color, #000);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.app-tabs .app-tab.active {
  background: var(--tg-theme-bg-color, #fff);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}



/* ============ Уроки / модули ============ */
.lessons-empty {
  padding: 48px 16px;
  text-align: center;
}
.lessons-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.lessons-empty h2   { margin: 0 0 8px; font-size: 1.3rem; }
.lessons-empty p    { margin: 4px 0; color: var(--hint); }
.lessons-empty-sub  { font-size: .9rem; }

/* --- Модуль: серый скруглённый блок --- */
.module {
  background: #f2f2f7;
  border-radius: 16px;
  margin-bottom: 16px;
  overflow: hidden;
  border: none;
  box-shadow: none;
}

/* --- Шапка модуля --- */
.module-header {
  padding: 16px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  transition: background .15s ease;
}
.module-header:hover { background: rgba(0,0,0,.03); }

.module-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.module-num {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8e8e93;
}
.module-toggle { font-size: 1rem; color: #8e8e93; }
.module-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: #1c1c1e;
}
.module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: #8e8e93;
  margin-top: 6px;
}
.module-level { padding: 0; background: transparent; }
.module-price { color: var(--warn); font-weight: 600; }
.module-free  { color: var(--ok); font-weight: 500; }

/* --- Список уроков внутри модуля --- */
.lesson-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: none;
}
.lesson-item {
  padding: 0 8px 6px 8px;
  border-bottom: none;

  border:0px solid red  ;
}
.lesson-item:last-child { padding-bottom: 12px; }

/* --- Карточка урока: белая, скруглённая --- */
.lesson-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: #fff;
  color: #1c1c1e;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: background .1s;
  text-decoration: none;
}
.lesson-link:hover { background: #f8f8fb; text-decoration: none; }
.lesson-title { font-size: 1rem; }
.lesson-flags { display: flex; gap: 4px; flex-wrap: wrap; font-size: .85rem; }
.lesson-price { color: var(--warn); font-weight: 600; }
.lesson-price-admin { color: var(--ok); }

.lesson-edit-btn {
    background: #ffcc00;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.1s, background 0.1s;
    color: #000;
}


/* ============ Урок (страница) ============ */
.lesson-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 10px;
  border-bottom: var(--border);
  margin-bottom: 10px;
}
.lesson-header-title { flex: 1; }
.lesson-header-title h1 { margin: 0; font-size: 1.3rem; }
.lesson-header-level {
  display: inline-block;
  margin-top: 4px;
  font-size: .85rem;
  color: var(--hint);
}
.back-btn,
.portal-back {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--bg2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .15s ease;
}
.back-btn:hover, .portal-back:hover { background: rgba(0,0,0,.08); }

.theory,
details.theory {
  margin-bottom: 16px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  padding: 12px 16px;
}
.theory summary {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}
.theory-content { margin-top: 8px; font-size: .96rem; line-height: 1.55; }
.theory-content h2 { font-size: 1.15rem; margin: 16px 0 8px; }
.theory-content h3 { font-size: 1.05rem; margin: 14px 0 6px; }
.theory-content p  { margin: 8px 0; }
.theory-content ul, .theory-content ol { margin: 8px 0 8px 20px; padding: 0; }
.theory-content li { margin: 4px 0; }
.theory-empty {
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--bg2);
  color: var(--hint);
  font-size: .9rem;
}

.exercise {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg2);
  box-shadow: var(--shadow);
}
.exercise .progress {
  font-size: .85rem;
  color: var(--hint);
  margin-bottom: 8px;
}
.exercise h3 { margin: 0 0 12px; font-size: 1.05rem; }
.exercise .body { font-size: 1rem; line-height: 1.7; margin-bottom: 16px; }

.slot-input,
.slot-select {
  display: inline-block;
  min-width: 100px;
  padding: 6px 10px;
  margin: 0 2px;
  border: 1.5px solid rgba(0,0,0,.15);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .95rem;
  transition: border-color .15s ease, background .15s ease;
}
.slot-input:focus,
.slot-select:focus {
  outline: none;
  border-color: var(--btn);
}
.slot-input.correct,
.slot-select.correct   { border-color: var(--ok); background: rgba(52,199,89,.08); }
.slot-input.incorrect,
.slot-select.incorrect { border-color: var(--danger); background: rgba(229,57,53,.06); }
.tip {
  display: inline-block;
  margin: 4px 0 4px 4px;
  font-size: .85rem;
  color: var(--danger);
}

.feedback {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 500;
}
.feedback.ok   { background: rgba(52,199,89,.12); color: var(--ok); }
.feedback.warn { background: rgba(255,159,10,.12); color: var(--warn); }

.result {
  text-align: center;
  padding: 40px 16px;
}
.result h1   { font-size: 1.8rem; margin: 0 0 12px; }
.result .score { font-size: 2.2rem; font-weight: 700; margin: 8px 0; }
.result .percent { font-size: 1.2rem; color: var(--hint); }

/* ============ Кнопки ============ */
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease, transform .1s ease, background .15s ease;
  text-align: center;
}
.btn-primary   { background: var(--btn); color: var(--btn-text); }
.btn-primary:hover   { opacity: .92; }
.btn-primary:active  { transform: scale(.97); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg2);
  color: var(--text);
}
.btn-secondary:hover { background: rgba(0,0,0,.08); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .92; }

/* ============ Paywall ============ */
.paywall {
  max-width: 420px;
  margin: 24px auto;
  padding: 32px 24px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--bg2);
  box-shadow: var(--shadow-lg);
}
.paywall h1 { margin: 0 0 12px; font-size: 1.4rem; }
.paywall p  { color: var(--hint); margin: 0 0 16px; }
.paywall .price {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--warn);
  margin: 12px 0 20px;
}
.paywall .btn-primary   { display: block; width: 100%; margin-bottom: 8px; }
.paywall .btn-secondary { display: block; width: 100%; }

/* ============ Библиотека ============ */
.library-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0 16px;
  border-bottom: var(--border);
  margin-bottom: 16px;
}
.library-header h1 { margin: 0; font-size: 1.3rem; }
.library-count     { color: var(--hint); font-size: .9rem; }
.library-authors   { display: flex; flex-direction: column; gap: 24px; }
.author-title      { font-size: 1.05rem; margin: 0 0 10px; }
.library-list      { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.library-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg2);
  border: var(--border);
  cursor: pointer;
  transition: transform .1s ease, box-shadow .15s ease;
}
.library-card:hover { box-shadow: var(--shadow); }
.library-card:active { transform: scale(.99); }
.library-card-cover {
  flex: 0 0 auto;
  width: 48px; height: 60px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--btn), #7cb3e8);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  color: #fff;
  font-size: 1.4rem;
}
.library-card-num {
  position: absolute;
  bottom: 2px; right: 4px;
  font-size: .65rem;
  font-weight: 700;
  opacity: .8;
}
.library-card-body { flex: 1; min-width: 0; }
.library-card-title {
  font-weight: 600;
  font-size: .98rem;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-card-subtitle {
  font-size: .85rem;
  color: var(--hint);
  margin-bottom: 4px;
}
.library-card-meta {
  font-size: .8rem;
  color: var(--hint);
}
.library-card-arrow {
  flex: 0 0 auto;
  font-size: 1.2rem;
  color: var(--hint);
}

.library-item {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: var(--border);
  cursor: pointer;
  list-style: none;
  margin-bottom: 8px;
}
.library-item:hover { background: rgba(0,0,0,.04); }
.library-title { font-weight: 500; }

/* Пагинация */
.lib-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 20px 0;
  font-size: .9rem;
}
.lib-pagination a,
.lib-pagination span {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  color: var(--text);
}
.lib-pagination a:hover { background: rgba(0,0,0,.08); text-decoration: none; }
.lib-page-cur  { background: var(--btn) !important; color: var(--btn-text) !important; font-weight: 600; }
.lib-page-disabled { opacity: .4; }
.lib-page-dots { background: transparent !important; }
.lib-page-info {
  flex: 1 1 100%;
  font-size: .8rem;
  color: var(--hint);
  margin-top: 8px;
}

/* Читалка (строки) */
.lib-chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 12px 0;
}
.lib-chapter-nav a,
.lib-chap-cur {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  color: var(--text);
  font-size: .85rem;
}
.lib-chap-cur { background: var(--btn) !important; color: var(--btn-text) !important; font-weight: 600; }

.lib-trans-panel {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: var(--border);
  box-shadow: var(--shadow);
  min-height: 40px;
  font-size: .92rem;
  transition: box-shadow .15s ease;
}
.lib-trans-panel.is-stuck { box-shadow: var(--shadow-lg); }
.lib-trans-hint { color: var(--hint); font-size: .85rem; }
.lib-trans-word { font-weight: 600; }
.lib-trans-arrow { color: var(--hint); }
.lib-trans-value { color: var(--btn); font-weight: 600; }
.lib-trans-src { font-size: .85rem; opacity: .7; }
.lib-trans-err { color: var(--danger); }
.lib-trans-loading { color: var(--hint); }

.lib-lines { display: flex; flex-direction: column; gap: 12px; }
.lib-line-pair {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(0,0,0,.06);
}
.lib-line-main { font-size: 1rem; line-height: 1.7; }
.lib-line-ru   { font-size: .9rem; color: var(--hint); margin-top: 2px; }
.lib-word {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
  transition: background .1s ease;
}
.lib-word:hover { background: rgba(30,136,229,.12); }
.lib-word.active { background: var(--btn); color: var(--btn-text); }

/* ============ Портал / словарь ============ */

.portal-welcome { padding: 16px; background: var(--bg2); border-radius: 12px; margin-bottom: 16px; }
.portal-sources-info { display: flex; flex-direction: column; gap: 8px; }
.portal-source-item { background: var(--bg); padding: 12px; border-radius: 8px; border: 1px solid var(--border); }
.portal-source-item b { display: block; margin-bottom: 4px; }
.portal-source-item span { font-size: 0.9rem; color: var(--hint); }

.portal-search-bar {
  position: relative;
  display: flex;
  margin-bottom: 12px;
}

.portal-search-bar input {
  flex: 1;
  /* Отступ справа 52px, чтобы текст не залезал под кнопку */
  padding: 12px 52px 12px 16px;
  border: 1.5px solid rgba(0,0,0,.1);
  border-radius: var(--radius);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-size: .98rem;
  transition: border-color .15s ease;
  width: 100%;
  box-sizing: border-box;
}

.portal-search-bar input:focus {
  outline: none;
  border-color: var(--btn);
  background: var(--bg);
}

.portal-search-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0; /* Растягиваем на всю высоту инпута */
  width: 48px;
  border: none;
  /* Скругляем только правые углы в такт с инпутом */
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 1.2rem;
  cursor: pointer;
  transition: opacity .15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-search-btn:hover { opacity: .92; }

.portal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.portal-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg2);
  font-size: .85rem;
  cursor: pointer;
  user-select: none;
}
.portal-filter input { accent-color: var(--btn); }

.portal-stats-card {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg2);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.portal-stats-card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.portal-stats-line { margin: 6px 0; font-size: .95rem; color: var(--hint); }
.portal-stats-line b { color: var(--text); }
.portal-stats-card .btn-primary { margin-top: 12px; width: 100%; }

.portal-dict-title {
  margin: 20px 0 10px;
  font-size: 1.05rem;
}
.portal-count { color: var(--hint); font-size: .9rem; font-weight: 400; }

.portal-hits { display: flex; flex-direction: column; gap: 10px; }
.portal-hit {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg2);
  border: var(--border);
}
.portal-hit-name { font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.portal-hit-html { font-size: .93rem; color: var(--text); line-height: 1.55; }
.portal-hit-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.portal-more { font-size: .88rem; }

.portal-btn-learn,
.portal-btn-learn-learning {
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s ease;
}
.portal-btn-learn          { background: var(--btn); color: var(--btn-text); }
.portal-btn-learn-learning { background: rgba(52,199,89,.15); color: var(--ok); }
.portal-btn-learn:hover,
.portal-btn-learn-learning:hover { opacity: .9; }
.portal-btn-learn:disabled,
.portal-btn-learn-learning:disabled { opacity: .6; cursor: wait; }

.portal-lemma-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
  border-bottom: var(--border);
  margin-bottom: 16px;
}
.portal-lemma-header h2 { flex: 1; margin: 0; font-size: 1.4rem; }
.portal-lemma-audio-btn {
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--bg2);
  font-size: 1.1rem;
  cursor: pointer;
}
.portal-lemma-audio-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.portal-lemma-audio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
}
.portal-lemma-audio-item audio { flex: 1; height: 32px; }
.portal-lemma-audio-place { font-size: .85rem; color: var(--hint); }

.portal-group {
  margin: 12px 0;
  border-radius: var(--radius);
  background: var(--bg2);
  overflow: hidden;
}
.portal-group summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
}
.portal-paradigm {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.portal-paradigm td {
  padding: 8px 12px;
  border-top: var(--border);
  vertical-align: top;
}
.portal-paradigm .p-label { white-space: nowrap; color: var(--hint); font-weight: 500; }
.portal-paradigm .p-form  { font-weight: 500; }
.portal-paradigm .p-src   { color: var(--hint); font-size: .8rem; font-weight: 400; }

.portal-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
}
.portal-status-verified { background: rgba(52,199,89,.15); color: var(--ok); }
.portal-status-verified_with_variants { background: rgba(52,199,89,.15); color: var(--ok); }
.portal-status-disputed { background: rgba(255,159,10,.15); color: var(--warn); }

.portal-slot {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg2);
  margin-bottom: 10px;
}
.portal-slot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: .9rem;
}
.portal-slot-label { font-weight: 500; }
.portal-slot-forms { display: flex; flex-direction: column; gap: 6px; }
.portal-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: var(--border);
}
.portal-form { font-weight: 500; }
.portal-src  { color: var(--hint); font-size: .8rem; }
.portal-audio-count { color: var(--hint); font-size: .8rem; }
.portal-audio-player { flex: 1; height: 32px; }

.portal-btn-audio,
.portal-btn-usage {
  width: 34px; height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,.06);
  cursor: pointer;
  font-size: .95rem;
  transition: background .15s ease;
}
.portal-btn-audio:hover,
.portal-btn-usage:hover { background: rgba(0,0,0,.12); }

.portal-verify-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.portal-btn-ok,
.portal-btn-wrong,
.portal-btn-variant {
  flex: 1;
  padding: 8px 6px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
}
.portal-btn-ok      { background: rgba(52,199,89,.15); color: var(--ok); }
.portal-btn-wrong   { background: rgba(229,57,53,.12); color: var(--danger); }
.portal-btn-variant { background: rgba(255,159,10,.15); color: var(--warn); }
.portal-btn-ok:hover,
.portal-btn-wrong:hover,
.portal-btn-variant:hover { opacity: .85; }

.portal-next-card {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg2);
  box-shadow: var(--shadow);
}
.portal-next-lemma { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.portal-next-label { color: var(--hint); margin-bottom: 12px; font-size: .9rem; }
.portal-next-card .btn-secondary { display: block; width: 100%; margin-top: 12px; }

/* Карта / модалки */
.portal-map-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.portal-map-box {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius);
  background: var(--bg);
  padding: 16px;
  box-shadow: var(--shadow-lg);
}
.portal-map-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
}
.portal-map-head button {
  border: none;
  background: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--hint);
}
#map-search,
#map-canvas { width: 100%; }
#map-search {
  padding: 10px 12px;
  border: 1.5px solid rgba(0,0,0,.1);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font: inherit;
  font-size: .95rem;
}
#map-canvas { height: 240px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.portal-map-suggest { position: relative; }
.map-sug-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.map-sug-item:hover { background: var(--bg2); }
.map-sug-item small { color: var(--hint); }
.portal-map-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.portal-map-foot span { font-size: .9rem; color: var(--hint); }

/* Читательский билет (fab) */
#reading-ticket-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--btn);
  color: var(--btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 100;
  transition: transform .15s ease;
}
#reading-ticket-fab:hover { transform: scale(1.05); }

.reading-ticket-block {
  padding: 16px;
  background: var(--bg2);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.reading-ticket-block h3 { margin: 0 0 12px; font-size: 1.1rem; }
.reading-ticket-empty { padding: 12px; opacity: .6; font-size: .9rem; }
.reading-ticket-list { display: flex; flex-direction: column; gap: 12px; }
.reading-ticket-item {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0,0,0,.05);
}

/* Профиль */
.profile-header { margin-bottom: 24px; }
.profile-header h1 { margin: 0; font-size: 1.4rem; }
.profile-section {
  padding: 16px;
  background: var(--bg2);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.profile-section h3 { margin: 0 0 12px; font-size: 1.05rem; }

/* ============ Тренажёр ============ */
.trainer-stats-card {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg2);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.trainer-stats-card h3 { margin: 0 0 8px; font-size: 1.2rem; }
.trainer-stats-card p  { margin: 4px 0; font-size: .95rem; color: var(--hint); }
.trainer-stats-card p b { color: var(--text); }

.trainer-menu { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.trainer-menu-btn {
  padding: 14px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-size: .98rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.trainer-menu-btn:hover { background: rgba(0,0,0,.06); }

.trainer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
  border-bottom: var(--border);
  margin-bottom: 16px;
}
.trainer-header h2 { flex: 1; margin: 0; font-size: 1.2rem; }

.trainer-list { display: flex; flex-direction: column; gap: 8px; }
.trainer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
}
.trainer-lemma { flex: 1; font-weight: 500; }
.trainer-meta  { color: var(--hint); font-size: .8rem; }

.trainer-review-header { font-size: .85rem; color: var(--hint); margin-bottom: 8px; text-align: center; }
.trainer-review-word {
  padding: 32px 16px;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
}
.trainer-review-translation {
  padding: 16px;
  text-align: center;
  font-size: 1.1rem;
  color: var(--hint);
  margin-bottom: 16px;
}
.trainer-review-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.trainer-review-buttons button {
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
}
#tr-show {
  display: block;
  width: 100%;
  margin: 12px 0;
}

/* ============ Адаптив ============ */
@media (max-width: 480px) {
  #app { padding: 8px 12px 80px; }
  .modules-header h1 { font-size: 1.2rem; }
  .portal-search-bar input { padding: 10px 14px; }
  .portal-search-btn { width: 44px; height: 44px; }
}


/* ============ Таблицы в теории урока ============ */
.theory-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  font-size: 0.95rem;
  background: var(--tg-theme-bg-color, #fff);
  border: 1px solid var(--tg-theme-secondary-bg-color, #e5e5ea);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Заголовки таблицы */
.theory-content th {
  background: var(--tg-theme-secondary-bg-color, #f2f2f7);
  color: var(--tg-theme-text-color, #1c1c1e);
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #e5e5ea);
}

/* Ячейки */
.theory-content td {
  padding: 12px 14px;
  color: var(--tg-theme-text-color, #1c1c1e);
  border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f2f2f7);
  vertical-align: top;
}

/* Убираем нижнюю границу у последней строки */
.theory-content tr:last-child td {
  border-bottom: none;
}

/* Чередование цветов строк (зебра) */
.theory-content tbody tr:nth-child(even) {
  background: var(--tg-theme-secondary-bg-color, #fafafa);
}

/* Эффект при наведении (для десктопа) */
.theory-content tbody tr:hover {
  background: var(--tg-theme-secondary-bg-color, #f0f0f5);
  transition: background 0.15s ease;
}

/* Скругление углов для первой и последней ячейки в заголовке */
.theory-content th:first-child { border-top-left-radius: 10px; }
.theory-content th:last-child { border-top-right-radius: 10px; }


/* ============ Табы упражнений ============ */
.ex-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 4px;
}
.ex-tab {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #d0d0d5;
  background: #fff;
  color: #1c1c1e;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.ex-tab.active {
  background: #0a84ff;
  border-color: #0a84ff;
  color: #fff;
}
.ex-tab.done {
  background: #ebf9f0;
  border-color: #34c759;
  color: #34c759;
}
.ex-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.ex-actions button {
  flex: 1;
}
.ex-done-actions {
  margin-top: 16px;
  padding: 12px;
  background: #ebf9f0;
  border-radius: 10px;
  text-align: center;
}
.ex-done-text {
  color: #34c759;
  font-weight: 600;
  margin-bottom: 8px;
}

.lesson-rating { 
  display: flex; 
  align-items: center; 
  justify-content: flex-end; /* Выравниваем всё вправо */
  gap: 6px; 
  margin: 0 0 10px 0; 
  padding: 10px 16px; 
 /* background: var(--bg2); */
  border-radius: var(--radius); 
}
.rating-heart { font-size: 1.2rem; cursor: pointer; opacity: 0.4; transition: opacity 0.2s; }
.rating-heart.active { opacity: 1; }
.rating-avg { font-size: 0.8rem; color: #8e8e93; margin-left: 4px; }

.lesson-comments-section { margin-top: 32px; padding-top: 16px; border-top: 1px solid #e5e5ea; }
.lesson-comments-section h3 { font-size: 1.1rem; margin-bottom: 16px; }
.comment-item {
  background: #fff;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  position: relative; /* Чтобы кнопка удаления позиционировалась относительно карточки */
}
.comment-head { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 0.85rem; }
.comment-date { color: #8e8e93; }
.comment-text { font-size: 0.95rem; line-height: 1.4; margin-bottom: 8px; }
.btn-del { position: absolute; top: 8px; right: 8px; background: transparent; border: none; cursor: pointer; font-size: 0.9rem; }
.comment-form { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #d0d0d5; font-family: inherit; resize: vertical; min-height: 60px; }


 

.comment-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.85rem;
  padding-right: 30px; /* Отступ справа, чтобы дата не наезжала на кнопку удаления */
}

.comment-date {
  color: #8e8e93;
}

.comment-text {
  font-size: 0.95rem;
  line-height: 1.4;
  margin-bottom: 8px;
  padding-right: 30px; /* Текст тоже не должен залезать под кнопку */
}

.btn-del {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.btn-del:hover {
  opacity: 1;
}

.comment-replies { margin-left: 20px; padding-left: 10px; border-left: 2px solid #e5e5ea; margin-top: 8px; }
.comment-actions { display: flex; gap: 12px; margin-top: 6px; }
.btn-link { background: none; border: none; color: #0a84ff; cursor: pointer; font-size: 0.85rem; padding: 0; }
.btn-del { color: #ff3b30; }

.lesson-rating-badge, .lesson-comments-badge {
    font-size: 0.75rem;
    color: #8e8e93;
    background: var(--tg-theme-secondary-bg-color, #f2f2f7);
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 4px;
    white-space: nowrap;
}
.lesson-rating-badge { color: #ff3b30; }
.lesson-comments-badge { color: #0a84ff; }

.badge-admin {
  background: #ff9f0a;
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.days-picker { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.day-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid #d0d0d5; background: #fff; color: #1c1c1e;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.day-btn.active { background: #0a84ff; border-color: #0a84ff; color: #fff; }

.schedule-item { background: #f2f2f7; padding: 10px 14px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }


/* ============ Оценка усвоения уроков (avg/min) ============ */
.lesson-mastery-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
  margin-left: 4px;
}
.lesson-mastery-avg {
  background: rgba(52,199,89,0.15);
  color: #2a9d4a;
}
.lesson-mastery-min {
  background: rgba(255,159,10,0.15);
  color: #b8730a;
}

/* ============ Пометка «выкл.» у расписаний ============ */
.schedule-off-tag {
  font-size: 0.75rem;
  color: #ff3b30;
  font-weight: 600;
}

/* ============ Сводка и таблица достижений в профиле ============ */
.achievement-summary { line-height: 1.5; }
.achievement-table { margin-top: 4px; }
.achievement-table tr:hover { background: rgba(0,0,0,0.03); }


.app-ribbon-wrap {
  width: 140px;
  padding: 4px 0;
}

.app-ribbon {
  width: 100px; 
  height: 38px;
  border-radius: 6px;
  
  /* Убираем skewY, чтобы линии не превращались в ступеньки */
  transform: rotate(-5deg); 
  transform-origin: left center;
  
  /* Маска для плавного растворения вправо */
  mask-image: linear-gradient(to right, rgba(0,0,0,1) 10%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,1) 10%, rgba(0,0,0,0) 100%);
  
  /* Легкое размытие всей ленты (сглаживает границы цветов) */
  filter: blur(0.5px);
  
  box-shadow: 2px 4px 10px rgba(0,0,0,0.1);
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

/* Блик, подчеркивающий форму ленты */
.app-ribbon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to right, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 60%, rgba(0,0,0,0.1) 100%);
  pointer-events: none;
}

/* Бейджи оценок усвоения уроков */
.badge-mastery-avg {
  background: #e5f8eb;
  color: #28a745;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 4px;
}
.badge-mastery-min {
  background: #fff3cd;
  color: #b8860b;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 4px;
}
.badge-mastery-unpassed {
  background: #e0f0ff; /* Яркий светло-синий */
  color: #007aff;      /* Насыщенный синий */
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 4px;
}
.badge-mastery-empty {
  background: #f2f2f7;
  color: #8e8e93;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 4px;
}

.badge-mastery-low {
  background: #fff3cd;
  color: #856404;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 4px;
}
.badge-mastery-passed {
  background: #e5f8eb;
  color: #28a745;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 4px;
}

/* Центрируем шапку и контент web-версии */
.modules-header,
.app-tabs {
    max-width: 860px;
    margin: 0 auto;
}
.modules-header {
    padding: 10px 16px 0;
}

/* Выравнивание кнопок в блоке результата */
.feedback .btn-primary,
.feedback .btn-secondary {
    display: inline-block;
    margin-right: 8px;
    width: auto;
}

.feedback .btn-primary {
    margin-left: 10px;
}


/* ============ Футер и языки ============ */
/* Футер */
/* ============ Футер и языки ============ */
.app-footer {
  max-width: 720px;
  margin: 40px auto 0;
  background: var(--tg-theme-bg-color, #fff);
  border-top: 1px solid var(--tg-theme-secondary-bg-color, #e5e5ea);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 16px;
  color: var(--tg-theme-hint-color, #8e8e93);
  font-size: 0.9rem;
}
.lang-select {
  padding: 6px 10px;
  border: 1px solid #d0d0d5;
  border-radius: 8px;
  background: var(--tg-theme-secondary-bg-color, #f2f2f7);
  color: var(--tg-theme-text-color, #1c1c1e);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}
.footer-content {
    max-width: 720px; /* Такая же ширина, как у контента */
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    width: 100%;
}

a.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    padding: 0;
    line-height: 1;
    color: var(--text);
}
/* =====
 =====
 =====
 =====
 =====
 =====
 =====*/



