/* Панель чтения и всплывашка «Объяснить». Живут поверх страницы. */

.tb-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border-soft);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13.5px;
}
.tb-left { flex: 1 1 auto; min-width: 0; }
.tb-right { flex: 1 1 auto; display: flex; justify-content: flex-end; }

.tb-btn {
  display: inline-block; padding: 6px 11px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--fg) !important; text-decoration: none; white-space: nowrap;
  font-size: 13.5px; line-height: 1.2;
}
.tb-btn:hover { border-color: var(--accent); }

.tb-theme { display: flex; gap: 4px; padding: 3px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); flex: 0 0 auto; }
.tb-theme button {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 5px 11px; border-radius: 7px; font-size: 13px; line-height: 1.2;
  color: var(--muted); font-family: inherit;
}
.tb-theme button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 650; }

.tb-count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 3px;
  border-radius: 999px; background: var(--surface2); color: var(--muted);
  font-size: 11.5px; text-align: center;
}
.tb-count:empty { display: none; }
.tb-count.tb-pending { background: var(--accent); color: #fff; }

.tb-pop { position: absolute; z-index: 60; }
.tb-ask {
  appearance: none; cursor: pointer; font-family: inherit; font-size: 13.5px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 8px 24px var(--shadow); max-width: 82vw;
}
.tb-ask[disabled] { opacity: .75; cursor: default; }

@media (max-width: 560px) {
  .tb-bar { gap: 7px; padding: 8px 10px; flex-wrap: wrap; }
  .tb-theme button { padding: 5px 9px; font-size: 12.5px; }
  .tb-btn { padding: 6px 9px; font-size: 12.5px; }
}

/* ---- подвал урока: отметка о прочтении и переход дальше ---- */

.tb-done { margin: 64px 0 0; padding-top: 30px; border-top: 2px solid var(--border); }

.tb-check {
  appearance: none; cursor: pointer; font-family: inherit; font-size: 15.5px;
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 14px 17px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); text-align: left;
}
.tb-check:hover { border-color: var(--accent); }
.tb-check.on { border-color: var(--accent); color: var(--strong); }
.tb-box {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  border: 2px solid var(--border); display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 800; line-height: 1;
}
.tb-check.on .tb-box { background: var(--accent); border-color: var(--accent); color: #fff; }

.tb-next {
  display: block; margin-top: 12px; padding: 16px 18px; border-radius: 12px;
  border: 1px solid var(--accent); background: var(--surface);
  text-decoration: none; border-bottom-width: 1px !important;
}
.tb-next:hover { background: var(--surface2); }
.tb-next-lab {
  display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 700; color: var(--accent-fg); margin-bottom: 4px;
}
.tb-next-name { display: block; font-size: 17.5px; font-weight: 700; color: var(--strong); }

.tb-hint { margin: 14px 2px 0; font-size: 13px; line-height: 1.55; color: var(--dim); }

.tb-pos { display: inline-block; margin-left: 10px; font-size: 12.5px; color: var(--dim); }
.tb-badge { color: var(--accent-fg); font-weight: 800; }

/* ---- прогресс на главной ---- */

.tb-progress { margin: 22px auto 0; max-width: 620px; }
.tb-progress-top {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--muted); margin-bottom: 7px;
}
.tb-progress-top b { color: var(--strong); font-size: 15px; }
.tb-rail { height: 7px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.tb-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }

.mod-stat {
  display: inline-block; margin-left: 10px; font-size: 12.5px;
  font-weight: 600; color: var(--dim); letter-spacing: 0; text-transform: none;
}
.mod-stat.full { color: var(--accent-fg); }

ol.lessons a { position: relative; }
ol.lessons .l-check {
  position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: transparent;
}
ol.lessons li.done .l-check { background: var(--accent); border-color: var(--accent); color: #fff; }
ol.lessons li.done .l-name { color: var(--muted); }
ol.lessons a { padding-right: 48px !important; }

@media (max-width: 560px) {
  .tb-pos { display: none; }
  .tb-next-name { font-size: 16px; }
}
