/* Component library — spec §2 (adapted from prototype/index.html). */

/* --- buttons --- */
.mainbtn {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: var(--r-btn);
  background: var(--phase-accent);
  color: #fff;
  font: 600 17px/1 -apple-system, 'Onest', system-ui;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s;
}
.mainbtn:disabled {
  opacity: 0.4;
}
.mainbtn i {
  width: 18px;
  height: 18px;
}
.mainbtn.ghost {
  background: var(--surface-grouped);
  color: var(--phase-accent);
}
/* the subdued "negative" of a stacked pair — same size as the primary, just quieter (smoke-#5 #8/#9) */
.mainbtn.neutral {
  background: var(--surface-grouped);
  color: var(--text-secondary);
  font-weight: 500;
}
/* two full-width buttons stacked with a gap (primary + neutral), replacing the fat-button-+-tiny-pill */
.btn-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sec-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.sec {
  height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--separator);
  background: var(--bg-elevated);
  color: var(--phase-accent);
  font: 500 13px/1 -apple-system, 'Onest', system-ui;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sec i {
  width: 15px;
  height: 15px;
}

/* --- tab bar --- */
.tabbar {
  display: flex;
  gap: 4px;
}
.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 3px;
  color: var(--text-tertiary);
  cursor: pointer;
  font: 500 10px/1.2 -apple-system, 'Onest', system-ui;
}
.tabbar .tab.on {
  color: var(--phase-accent);
}
.tabbar .tab i {
  width: 25px;
  height: 25px;
}

/* --- titles / labels --- */
.big-title {
  font: 700 32px/1.1 -apple-system, 'Onest', system-ui;
  letter-spacing: -0.02em;
  margin: 2px 2px 14px;
}
.h1 {
  font: 600 26px/1.18 -apple-system, 'Onest', system-ui;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.sub {
  font: 400 15px/1.4 -apple-system, 'Onest', system-ui;
  color: var(--text-secondary);
}
.seclabel {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 12px/1 -apple-system, 'Onest', system-ui;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 2px 8px;
}
.seclabel i {
  width: 14px;
  height: 14px;
}

/* --- grouped list / rows --- */
.glist {
  background: var(--surface-grouped);
  border-radius: var(--r-card);
  overflow: hidden;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  min-height: 54px;
  position: relative;
  cursor: pointer;
}
.row + .row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 48px;
  right: 0;
  height: 0.5px;
  background: var(--separator);
}
.row .st {
  width: 26px;
  height: 26px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.row .st i {
  width: 23px;
  height: 23px;
}
.row .ctext {
  flex: 1;
  min-width: 0;
}
.row .ctext .t {
  font: 400 16px/1.25 -apple-system, 'Onest', system-ui;
}
.row .ctext .m {
  font: 400 12px/1.3 -apple-system, 'Onest', system-ui;
  color: var(--text-tertiary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.row .ctext .m i {
  width: 12px;
  height: 12px;
}
.row .chev {
  color: var(--text-tertiary);
}
.row .chev i {
  width: 18px;
  height: 18px;
}
.row.done .ctext .t {
  color: var(--text-secondary);
}
.row.done .st {
  color: var(--phase-accent);
}
.row.todo .st,
.row.todo .ctext .t {
  color: var(--text-tertiary);
}
.row.quiz .st {
  color: var(--system-purple);
}
.row.current {
  background: color-mix(in srgb, var(--phase-accent) 12%, transparent);
}
.row.current::after {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--phase-accent);
}
.row.current .st {
  color: var(--phase-accent);
}
.row.current .ctext .t {
  font-weight: 600;
  color: var(--text);
}
.badge-here {
  font: 600 10px/1 -apple-system, 'Onest', system-ui;
  color: #fff;
  background: var(--phase-accent);
  padding: 4px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

/* --- card --- */
.card {
  background: var(--bg-elevated);
  border-radius: var(--r-card);
  padding: 18px;
}
/* a tappable card (owner smoke-#5 #9: the quiz "разбор в чат" card is the chat door) — button reset */
.card.tappable {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 14px;
  text-align: left;
  border: none;
  font: inherit;
  cursor: pointer;
}
/* quiz-row status glyphs (owner smoke-#5 #10): passed = accent, failed = muted (default purple = todo) */
.row.quiz.q-passed .st {
  color: var(--phase-accent);
}
.row.quiz.q-failed .st {
  color: var(--text-tertiary);
}

/* --- toast --- */
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(96px + var(--safe-bottom));
  z-index: 60;
  background: rgba(20, 20, 22, 0.92);
  color: #fff;
  border-radius: var(--r-card);
  padding: 13px 15px;
  font: 500 14px/1.4 -apple-system, 'Onest', system-ui;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.25s;
  pointer-events: none;
  backdrop-filter: blur(10px);
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast .tt {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.toast .tt i {
  width: 13px;
  height: 13px;
}

/* --- Class-B deferred-commit interstitial --- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 66;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none;
  align-items: flex-end;
}
.scrim.show {
  display: flex;
}
.isheet {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 20px 18px calc(30px + var(--safe-bottom));
}
.isheet .ihead {
  display: flex;
  align-items: center;
  gap: 13px;
}
.isheet .iic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--phase-accent) 14%, transparent);
  color: var(--phase-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.isheet .iic i {
  width: 22px;
  height: 22px;
}
.isheet .itx {
  flex: 1;
  min-width: 0;
}
.isheet .ititle {
  font: 600 18px/1.2 -apple-system, 'Onest', system-ui;
}
.isheet .isub {
  font: 400 14px/1.3 -apple-system, 'Onest', system-ui;
  color: var(--text-secondary);
  margin-top: 2px;
}
.isheet .inum {
  font: 600 17px/1 -apple-system, 'Onest', system-ui;
  color: var(--text-tertiary);
  min-width: 22px;
  text-align: right;
  flex: none;
}
.isheet .iprog {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-grouped);
  margin: 16px 0;
  overflow: hidden;
}
.isheet .iprog > i {
  display: block;
  height: 100%;
  background: var(--phase-accent);
  width: 0;
}
.isheet .icancel {
  width: 100%;
  height: 50px;
  border-radius: var(--r-btn);
  background: var(--surface-grouped);
  border: none;
  color: var(--phase-accent);
  font: 600 16px/1 -apple-system, 'Onest', system-ui;
  cursor: pointer;
}

/* --- spinner / skeleton --- */
.skeleton {
  background: linear-gradient(
    100deg,
    var(--surface-grouped) 30%,
    color-mix(in srgb, var(--surface-grouped) 60%, var(--bg)) 50%,
    var(--surface-grouped) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-tertiary);
}
/* Every loader glyph actually spins (owner #3 smoke: the Lucide "loader" SVG is static — it only turns
   if CSS animates it; nothing did, so every progress indicator looked frozen). One rule covers the
   full-screen .spinner AND the inline «наставник готовит разбор…» loaders. .lucide-loader is the class
   Lucide sets on the rendered <svg>; the bare attribute selector catches the brief pre-render <i>.
   prefers-reduced-motion already neutralises it globally (tokens.css). */
[data-lucide='loader'],
.lucide-loader {
  animation: spin 0.9s linear infinite;
  transform-origin: center;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
