/* Модуль «Задачи» — стили. Дизайн-система innochess (Geologica, brand #5451e7). */

:root {
  --brand: #5451e7;
  --brand-dark: #3d3ab0;
  --brand-mid: #6f6df0;
  --orange: #FF6B2B;
  --orange-light: #FFF0E8;
  --orange-mid: #FFD4BB;
  --green: #36b26b;
  --green-light: #e9f9ef;
  --red: #e0455a;
  --red-light: #fdedf0;
  --white: #ffffff;
  --bg: #f7f8ff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: rgba(84, 81, 231, 0.13);
  --card-bg: #ffffff;
  --shadow: 0 10px 30px rgba(84, 81, 231, 0.09);
}

/* двойной тап (ход кликом-кликом, кнопки) не должен зумить страницу; pinch-зум остаётся */
html, body { touch-action: manipulation; }
button, a, input, textarea, .chip, .block-card, .dots .d, .refl-cell { touch-action: manipulation; }
main { width: 100%; max-width: 1080px; min-width: 0; margin: 0 auto; padding: 28px 4% 80px; }
.screen { display: none; }
.screen.on { display: block; animation: rise 0.35s ease both; }
#scr-solve.on { animation: none; }  /* transform из анимации ломает position:fixed бара */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.page-title { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 900; letter-spacing: -0.02em; margin-bottom: 6px; }
.page-sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 26px; }

.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
}

/* ── вход ── */
.gate { text-align: center; padding: 60px 24px; }
.gate .pawn { font-size: 3rem; display: block; margin-bottom: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border-radius: 12px; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.95rem; font-weight: 700; text-decoration: none;
  background: var(--brand); color: var(--white); transition: background 0.2s, transform 0.15s;
  min-height: 48px;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(0.97); }
.btn.ghost { background: var(--white); color: var(--brand); border: 1.5px solid var(--brand); }
.btn.ghost:hover { background: var(--bg); }
.btn.warn { background: var(--white); color: var(--red); border: 1.5px solid var(--red); }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ── кто решает ── */
.who { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.who-label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.chip {
  padding: 9px 18px; border-radius: 40px; border: 1.5px solid var(--border);
  background: var(--white); cursor: pointer; font-family: inherit;
  font-size: 0.9rem; font-weight: 600; color: var(--text); transition: all 0.18s;
  min-height: 42px;
}
.chip:hover { border-color: var(--brand-mid); }
.chip.sel { background: var(--brand); border-color: var(--brand); color: var(--white); }

/* ── каталог задачников ── */
.book-filter { width: 100%; margin: 28px 0 14px; }
.book-filter-heading {
  display: flex; align-items: baseline; justify-content: space-between; gap: 18px;
  margin-bottom: 10px;
}
.book-filter-heading .section-h { margin: 0; }
.book-filter-heading p { color: var(--muted); font-size: .78rem; font-weight: 600; }
.book-cards {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px;
}
.book-card {
  position: relative; display: grid; grid-template-rows: 118px minmax(0, 1fr);
  gap: 10px; min-width: 0; padding: 12px; overflow: hidden;
  border: 1.5px solid var(--border); border-radius: 16px;
  background: var(--white); color: var(--text); text-align: left; cursor: pointer;
  font: inherit; box-shadow: 0 5px 18px rgba(84,81,231,.06);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.book-card:hover {
  border-color: var(--brand-mid); transform: translateY(-2px); box-shadow: var(--shadow);
}
.book-card.selected {
  border-color: var(--brand); background: linear-gradient(180deg, #fff, #f3f3ff);
  box-shadow: 0 0 0 3px rgba(84,81,231,.1), var(--shadow);
}
.book-card-cover { position: relative; display: flex; justify-content: center; min-width: 0; }
.book-card-cover img {
  width: 82px; height: 114px; object-fit: cover; border-radius: 6px;
  box-shadow: 0 5px 14px rgba(0,0,0,.17);
}
.book-card-selected {
  position: absolute; right: 0; top: 0; padding: 3px 7px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: .58rem; font-weight: 850;
}
.book-card-main { display: flex; flex-direction: column; min-width: 0; }
.book-card-main strong { font-size: .82rem; line-height: 1.3; }
.book-card-main small {
  margin-top: 3px; color: var(--muted); font-size: .65rem; line-height: 1.3;
}
.book-card-main em {
  margin-top: 7px; color: var(--brand-dark); font-size: .65rem;
  font-style: normal; font-weight: 750;
}
.book-card-progress {
  margin-top: auto; padding-top: 8px; color: var(--muted); font-size: .63rem;
  font-weight: 650;
}
.book-recommended {
  align-self: flex-start; margin-top: 6px; padding: 3px 7px; border-radius: 999px;
  background: var(--green-light); color: var(--green); font-size: .57rem;
  font-weight: 800; text-align: center;
}
.book-summary {
  display: grid; grid-template-columns: 100px minmax(0,1fr) auto; gap: 18px;
  align-items: center; margin: 14px 0 22px; padding: 16px 18px;
  background: var(--white); border: 1px solid var(--border); border-radius: 16px;
}
.book-summary-cover { width: 100px; height: 138px; object-fit: cover; border-radius: 7px; box-shadow: 0 5px 16px rgba(0,0,0,.16); }
.book-summary-main { min-width: 0; }
.book-summary-main h2 { font-size: 1.08rem; line-height: 1.3; margin: 5px 0 1px; }
.book-summary-author { color: var(--muted); font-size: .78rem; font-weight: 650; }
.book-summary-main p { color: var(--text); font-size: .84rem; line-height: 1.5; margin-top: 9px; }
.book-summary-progress { color: var(--muted); font-size: .76rem; margin-top: 8px; }
.book-summary-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.book-summary-badges span, .book-summary-badges strong, .book-skills span {
  padding: 3px 8px; border-radius: 999px; background: var(--bg);
  color: var(--brand-dark); font-size: .66rem; font-weight: 750;
}
.book-summary-badges strong { background: var(--green-light); color: var(--green); }
.book-dialog {
  width: min(900px, 94vw); max-height: 90vh; padding: 0; border: 0; border-radius: 18px;
  overflow: auto; color: var(--text); box-shadow: 0 28px 90px rgba(20,19,65,.32);
}
.book-dialog::backdrop { background: rgba(22,21,55,.58); }
.book-dialog form { position: relative; padding: 28px; }
.book-dialog-close {
  position: absolute; top: 12px; right: 12px; z-index: 1; border: 0;
  border-radius: 50%; background: var(--bg); color: var(--muted);
  width: 38px; height: 38px; cursor: pointer; font: inherit;
}
.book-dialog-content { display: grid; grid-template-columns: 190px minmax(0,1fr); gap: 26px; }
.book-dialog-content > img { width: 190px; max-height: 280px; object-fit: cover; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.book-dialog-content h2 { margin: 8px 42px 14px 0; line-height: 1.25; }
.book-dialog-content p { margin: 0 0 11px; font-size: .9rem; line-height: 1.58; }
.book-dialog-audience { padding: 10px 12px; background: var(--bg); border-radius: 9px; }
.book-editorial-note {
  margin: 14px 0 18px; padding: 10px 12px; border-left: 3px solid var(--brand);
  border-radius: 0 9px 9px 0; background: rgba(84,81,231,.06);
  color: var(--muted); font-size: .76rem; line-height: 1.5;
}
.book-introduction { margin-top: 14px; }
.book-intro-section + .book-intro-section {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border);
}
.book-intro-section h3 { margin: 0 0 9px; font-size: 1rem; line-height: 1.35; }
.book-intro-section p:last-child { margin-bottom: 0; }
.book-skills { display: flex; flex-wrap: wrap; gap: 6px; margin: 15px 0; }
.book-dialog dl { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.book-dialog dl div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; font-size: .8rem; }
.book-dialog dt { color: var(--muted); }
.book-dialog dd { font-weight: 650; }

@media (max-width: 900px) and (min-width: 621px) {
  .book-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── блоки ── */
.blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.block-card {
  background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 16px;
  padding: 18px; cursor: pointer; transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  text-align: left; font-family: inherit;
}
.block-card:hover { border-color: var(--brand-mid); transform: translateY(-2px); box-shadow: var(--shadow); }
.block-card .b-title { font-weight: 800; font-size: 1rem; margin-bottom: 4px; }
.block-card .b-meta { color: var(--muted); font-size: 0.8rem; margin-bottom: 12px; }
.block-card .b-bar { height: 8px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.block-card .b-bar i { display: block; height: 100%; background: var(--green); border-radius: 6px; }
.block-card.done { border-color: rgba(54, 178, 107, 0.4); background: linear-gradient(0deg, var(--green-light), var(--white) 60%); }
.block-card.active-b { border-color: var(--orange); }
.block-card.ready-close {
  border: 2px solid #10b981;
  background: linear-gradient(135deg,rgba(16,185,129,.16),rgba(245,158,11,.10));
  box-shadow: 0 8px 26px rgba(16,185,129,.18);
}
.block-card.ready-close:hover { border-color:#059669; box-shadow:0 12px 30px rgba(16,185,129,.25); }
.b-badge { display: inline-block; font-size: 0.72rem; font-weight: 800; padding: 3px 10px; border-radius: 20px; margin-bottom: 8px; }
.b-badge.new { background: var(--bg); color: var(--brand); }
.b-badge.act { background: var(--orange-light); color: var(--orange); }
.b-badge.fin { background: var(--green-light); color: var(--green); }
.b-badge.ready { background:#059669; color:#fff; }
.b-finish-hint { color:#047857; font-size:.78rem; font-weight:800; margin:-5px 0 10px; }
.finish-reminder {
  margin:18px 0 24px; padding:18px; border:1px solid rgba(16,185,129,.45);
  border-radius:18px; background:linear-gradient(135deg,rgba(16,185,129,.10),rgba(255,255,255,.8));
}
.finish-reminder > div:first-child { margin-bottom:12px; }
.finish-reminder .section-h { margin:0 0 3px; }
.finish-reminder p { color:var(--muted); font-size:.86rem; }

/* ── решение ── */
.solve-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: start; gap: 10px 16px; margin-bottom: 14px;
}
.solve-info { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.solve-info > div { min-width: 0; }
.solve-status { display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }
.solve-num { font-size: 1.25rem; font-weight: 900; }
.solve-theme { color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.solve-source { color: var(--brand); font-size: 0.72rem; font-weight: 700; line-height: 1.35; margin-top: 2px; max-width: min(82vw, 620px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#timer { font-variant-numeric: tabular-nums; }
.turn-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 30px;
  font-size: 0.82rem; font-weight: 800; border: 1.5px solid var(--border); background: var(--white);
}
.turn-badge .dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #555; }
.turn-badge .dot.w { background: #fff; }
.turn-badge .dot.b { background: #333; }

.dots { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 6px; }
.block-points { font-size: 0.82rem; font-weight: 700; color: var(--muted); margin-bottom: 14px; }
.dots .d {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; color: var(--muted); background: var(--white);
}
.dots .d.cur { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px rgba(84,81,231,0.15); }
.dots .d.ok { background: var(--green); border-color: var(--green); color: #fff; }
.dots .d.score-75 { background: #f4c542; border-color: #dcae20; color: #4b3900; }
.dots .d.score-50 { background: var(--orange); border-color: #dc4f12; color: #fff; }
.dots .d.bad { background: var(--red); border-color: var(--red); color: #fff; }
.dots .d.shown { background: var(--muted); border-color: var(--muted); color: #fff; }

.live-comp {
  display: grid; grid-template-columns: minmax(150px, 1.1fr) auto auto minmax(240px, 1.6fr);
  align-items: center; gap: 20px; position: relative; overflow: hidden;
  background: var(--white); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 13px 18px 16px; margin-bottom: 18px;
}
.live-comp-title { display: flex; flex-direction: column; min-width: 0; }
.live-comp-title > span { font-size: 0.78rem; font-weight: 900; color: var(--brand); text-transform: uppercase; }
.live-comp-title small { color: var(--muted); font-size: 0.72rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-comp-metric { display: flex; flex-direction: column; min-width: 78px; }
.live-comp-metric strong { color: var(--text); font-size: 1.08rem; font-weight: 900; line-height: 1.15; }
.live-comp-metric span { color: var(--muted); font-size: 0.68rem; font-weight: 650; }
.live-comp-goal { color: var(--brand-dark); font-size: 0.86rem; font-weight: 800; line-height: 1.35; }
.live-comp-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--bg); }
.live-comp-progress i { display: block; width: 0; height: 100%; background: var(--green); transition: width 0.4s ease; }

.solve-grid { display: grid; grid-template-columns: minmax(280px, 560px) minmax(240px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 760px) {
  .live-comp { grid-template-columns: 1fr auto auto; gap: 10px 14px; padding: 11px 13px 14px; }
  .live-comp-goal { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 9px; }
  .live-comp-metric { min-width: 60px; }
  .solve-grid { grid-template-columns: 1fr; gap: 14px; }
  /* панель действий прижата к низу экрана — «Сдать» всегда под пальцем */
  #scr-solve.on .solve-btns {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
    background: rgba(255,255,255,0.97); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    display: grid; grid-template-columns: auto 1fr; gap: 8px;
    padding: 10px 4% calc(10px + env(safe-area-inset-bottom));
  }
  #scr-solve.on .solve-btns .btn { min-height: 46px; padding: 10px 14px; }
  #scr-solve.on .solve-btns .report-link { grid-column: 1 / -1; }
  #scr-solve.on #btn-back-blocks { display: none; }
  #scr-solve.on #btn-reset { font-size: 0.82rem; }
  #scr-solve.on .attempt-note { grid-column: 1 / -1; margin: 0; }
  #scr-solve.on { padding-bottom: 130px; }   /* контент не прячется за фикс-баром */
  .moves-list { min-height: 52px; }
}

.board-wrap { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); touch-action: none;
  width: 100%; max-width: min(100%, 560px); }
.board-wrap > div { max-width: 100% !important; }  /* контейнер cm-chessboard не шире обёртки */

.moves-panel { display: flex; flex-direction: column; gap: 14px; }
.moves-list {
  min-height: 74px; background: var(--bg); border-radius: 12px; padding: 12px 14px;
  font-size: 0.95rem; font-weight: 600; line-height: 1.9; letter-spacing: 0.01em;
}
.moves-list .mnum { color: var(--muted); font-weight: 500; margin-right: 2px; }
.moves-list .mv { display: inline-block; padding: 0 6px; border-radius: 6px; margin-right: 2px; }
.moves-list .mv.last { background: rgba(84,81,231,0.12); color: var(--brand-dark); }
.moves-list .hint-empty { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.solve-btns { display: flex; flex-direction: column; gap: 10px; }
.attempt-note { color: var(--muted); font-size: 0.78rem; text-align: center; }
.incomplete-note { background: #eef5ff; border-left: 4px solid var(--brand); border-radius: 7px; color: var(--brand-dark); font-size: 0.88rem; font-weight: 750; margin-top: 12px; padding: 11px 13px; }
.report-link { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.78rem; text-decoration: underline; cursor: pointer; padding: 4px; }
.report-link:hover { color: var(--red); }
.report-link:disabled { color: var(--green); cursor: default; text-decoration: none; }

/* ── ввод «в уме» ── */
.mental-premoves { background: var(--orange-light); border: 1px solid var(--orange-mid); border-radius: 12px; padding: 12px 16px; font-weight: 700; margin-bottom: 12px; }
.mental-premoves .lbl { display: block; font-size: 0.72rem; color: var(--orange); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.mental-input { width: 100%; border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; font-family: inherit; font-size: 1rem; min-height: 52px; }
.mental-input:focus { outline: none; border-color: var(--brand); }
.mental-parsed { font-size: 0.85rem; margin-top: 8px; min-height: 22px; }
.mental-parsed .okp { color: var(--green); font-weight: 700; }
.mental-parsed .badp { color: var(--red); font-weight: 700; }
.mental-hint { font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; line-height: 1.4; }
.mental-cells { display: flex; flex-direction: column; gap: 8px; }
.mrow { display: flex; align-items: center; gap: 8px; }
.mnum { min-width: 34px; text-align: right; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.mcell { width: 88px; border: 1.5px solid var(--border); border-radius: 10px; padding: 9px 10px; font-family: inherit; font-size: 1rem; text-align: center; }
.mcell:focus { outline: none; border-color: var(--brand); }
.mcell.ok { border-color: var(--green); background: var(--green-light); }
.mcell.bad { border-color: var(--red); background: var(--red-light); }

/* ── результат ── */
.result-card { border-radius: 16px; padding: 20px; margin-top: 16px; animation: rise 0.3s ease both; }
.result-card.ok { background: var(--green-light); border: 1.5px solid rgba(54,178,107,0.35); }
.result-card.bad { background: var(--red-light); border: 1.5px solid rgba(224,69,90,0.3); }
.result-title { font-size: 1.15rem; font-weight: 900; margin-bottom: 6px; }
.result-card.ok .result-title { color: var(--green); }
.result-card.bad .result-title { color: var(--red); }
.result-meta { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.competition-result { background: rgba(255,255,255,0.78); border-left: 4px solid var(--brand); border-radius: 8px; padding: 10px 12px; margin: 10px 0; color: var(--brand-dark); font-size: 0.86rem; font-weight: 800; }
.competition-result.up { border-left-color: var(--orange); color: #b84112; }
.result-sol { background: rgba(255,255,255,0.75); border-radius: 10px; padding: 10px 14px; font-weight: 700; font-size: 0.95rem; line-height: 1.8; }
.result-sol .lbl { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; font-weight: 700; }
.result-refut { margin-top: 8px; font-size: 0.85rem; color: var(--muted); line-height: 1.7; }
.result-book { background: rgba(255,255,255,0.75); border-radius: 10px; padding: 10px 14px; margin-top: 10px; font-size: 0.9rem; line-height: 1.75; white-space: pre-line; }
.result-book .lbl { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; font-weight: 700; }
.result-btns { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ── рефлексия ── */
.refl-q { text-align: center; margin-bottom: 20px; }
.refl-q .q-emoji { font-size: 2.2rem; display: block; margin-bottom: 6px; }
.refl-q .q-text { font-size: 1.2rem; font-weight: 800; }
.refl-q .q-hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.refl-q.step-change { animation: refl-question-change 0.28s ease both; }
.refl-confirm {
  position: sticky; top: 76px; z-index: 20; max-width: 570px; margin: 0 auto 16px;
  padding: 11px 16px; border: 1px solid rgba(84,81,231,0.24); border-radius: 12px;
  color: var(--text); background: rgba(255,255,255,0.97); box-shadow: 0 10px 28px rgba(40,37,112,0.14);
  text-align: center;
}
.refl-confirm-title { color: var(--brand); font-size: 0.9rem; font-weight: 800; }
.refl-confirm-next { margin-top: 2px; font-size: 0.84rem; font-weight: 700; }
.refl-confirm.refl-confirm-pop { animation: refl-confirm-pop 0.3s ease both; }
.refl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.refl-cell {
  border: 2px solid var(--border); border-radius: 14px; padding: 10px; background: var(--white);
  min-width: 0; cursor: pointer; transition: border-color 0.15s, transform 0.15s;
  position: relative; font-family: inherit; text-align: left;
}
.refl-cell:hover { border-color: var(--brand-mid); transform: translateY(-2px); }
.refl-cell.sel { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(84,81,231,0.18); }
.refl-cell .rc-num { font-size: 0.82rem; font-weight: 800; margin-top: 8px; text-align: center; }
.refl-cell .rc-status {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 4px; color: var(--muted); font-size: 0.74rem; font-weight: 800;
}
.refl-cell .rc-status-dot {
  width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--white);
}
.refl-cell .rc-status.ok { color: var(--green); }
.refl-cell .rc-status.ok .rc-status-dot { border-color: var(--green); background: var(--green); }
.refl-cell .rc-status.score-75 { color: #9b7300; }
.refl-cell .rc-status.score-75 .rc-status-dot { border-color: #dcae20; background: #f4c542; }
.refl-cell .rc-status.score-50 { color: #c74a13; }
.refl-cell .rc-status.score-50 .rc-status-dot { border-color: #dc4f12; background: var(--orange); }
.refl-cell .rc-status.bad { color: var(--red); }
.refl-cell .rc-status.bad .rc-status-dot { border-color: var(--red); background: var(--red); }
.refl-cell .rc-status.shown { color: var(--muted); }
.refl-cell .rc-status.shown .rc-status-dot { border-color: var(--muted); background: var(--muted); }
.refl-cell .rc-score {
  margin-top: 2px; color: var(--text); font-size: 0.74rem; font-weight: 750;
  text-align: center;
}
.refl-cell .rc-meta {
  margin-top: 8px; color: var(--muted); font-size: 0.69rem; line-height: 1.35;
  text-align: center;
}
.refl-cell .rc-badges { position: absolute; top: -10px; right: -6px; font-size: 1.1rem; }
.refl-nav { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.mini-board { width: 100%; pointer-events: none; }

@keyframes refl-question-change {
  from { opacity: 0.45; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes refl-confirm-pop {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  .refl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .refl-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* ── итоги ── */
.summary-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.summary-table th { text-align: left; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.summary-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); font-weight: 600; }
.st-ok { color: var(--green); } .st-bad { color: var(--red); } .st-skip { color: var(--muted); }

/* ── сообщение о некорректной задаче ── */
.report-dialog { width: min(92vw, 500px); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 24px 70px rgba(24,25,48,0.24); }
.report-dialog::backdrop { background: rgba(24,25,48,0.48); }
.report-dialog form { padding: 24px; display: grid; gap: 16px; }
.report-dialog h2 { font-size: 1.2rem; }
.report-dialog p { color: var(--muted); font-size: 0.85rem; }
.report-dialog label { display: grid; gap: 6px; font-size: 0.82rem; font-weight: 750; }
.report-dialog select, .report-dialog textarea { width: 100%; border: 1.5px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); font: inherit; padding: 10px 12px; }
.report-dialog textarea { min-height: 96px; resize: vertical; }
.report-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ── статистика ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 18px 0; }
.stat-tile { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 16px; text-align: center; }
.stat-tile .v { font-size: 1.35rem; font-weight: 900; color: var(--brand); }
.stat-tile .l { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.section-h { font-size: 1.1rem; font-weight: 800; margin: 30px 0 14px; }
/* книга вне зачёта: решать можно, но телебаллов и разблокировки не будет */
.set-note { margin: -6px 0 14px; padding: 9px 13px; border-radius: 10px;
            background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b;
            font-size: 0.85rem; line-height: 1.4; }

/* ── рейтинг ── */
.rating-section { width: 100%; max-width: 100%; min-width: 0; margin: 34px 0; }
.rating-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.rating-head .section-h { margin: 0 0 2px; }
.rating-scope { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.rating-tabs {
  display: inline-flex; padding: 4px; gap: 3px; border: 1px solid var(--border);
  border-radius: 11px; background: var(--white);
}
.rating-tabs button {
  min-height: 36px; padding: 7px 11px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: .72rem; font-weight: 750; white-space: nowrap;
}
.rating-tabs button.selected { background: var(--brand); color: #fff; }
.rating-mine { display: flex; gap: 18px; align-items: center; text-align: right; }
.rating-mine-item .v { font-size: 1.05rem; font-weight: 900; color: var(--brand); line-height: 1.2; }
.rating-mine-item .l { color: var(--muted); font-size: 0.7rem; font-weight: 600; }
.rating-table-wrap {
  width: 100%; max-width: 100%; max-height: 520px; overflow: auto; background: var(--white);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.rating-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.rating-table th {
  position: sticky; top: 0; z-index: 1; background: var(--white); text-align: left;
  color: var(--muted); font-size: 0.72rem; text-transform: uppercase;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
}
.rating-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 650; }
.rating-table tr:last-child td { border-bottom: 0; }
.rating-table tr.mine td { background: rgba(84,81,231,0.07); color: var(--brand-dark); }
.rating-place { width: 72px; font-weight: 900; color: var(--brand); }
.rating-player { min-width: 150px; }
.rating-player small { display: block; color: var(--brand); font-size: 0.68rem; font-weight: 800; }
.rating-progress { display: grid; grid-template-columns: minmax(90px, 1fr) 42px; align-items: center; gap: 10px; min-width: 160px; }
.rating-progress-bar { height: 7px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.rating-progress-bar i { display: block; height: 100%; border-radius: 6px; background: var(--green); }
.rating-progress span { color: var(--muted); font-size: 0.78rem; text-align: right; }
.rating-empty { color: var(--muted); text-align: center; padding: 24px !important; }

@media (max-width: 620px) {
  .book-filter-heading { display: block; }
  .book-filter-heading p { margin-top: 3px; }
  .book-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .book-card { grid-template-rows: 105px minmax(0, 1fr); padding: 10px; }
  .book-card-cover img { width: 72px; height: 101px; }
  .book-card-main strong { font-size: .76rem; }
  .book-summary { grid-template-columns: 74px minmax(0,1fr); gap: 13px; padding: 13px; }
  .book-summary-cover { width: 74px; height: 104px; }
  .book-summary-main p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .book-about-button { grid-column: 1 / -1; width: 100%; min-height: 42px; }
  .book-dialog form { padding: 22px 18px; }
  .book-dialog-content { grid-template-columns: 1fr; gap: 18px; }
  .book-dialog-content > img { width: 130px; max-height: 190px; justify-self: center; }
  .book-dialog-content h2 { margin-top: 7px; }
  .book-dialog dl div { grid-template-columns: 90px 1fr; }
  .rating-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .rating-tabs { width: 100%; }
  .rating-tabs button { flex: 1; }
  .rating-mine { width: 100%; justify-content: flex-start; text-align: left; }
  .rating-table { table-layout: fixed; }
  .rating-table th, .rating-table td { padding: 10px 7px; }
  .rating-table th:nth-child(1) { width: 54px; }
  .rating-table th:nth-child(2) { width: 32%; }
  .rating-table th:nth-child(3) { width: 28%; }
  .rating-place { width: auto; }
  .rating-player { min-width: 0; }
  .rating-progress { display: block; min-width: 0; }
  .rating-progress-bar { display: none; }
  .rating-progress span { display: block; text-align: left; }
}

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 0.9rem; font-weight: 600; z-index: 400; opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.toast.show { opacity: 1; }

.dots .d { cursor: pointer; }
.dots .d:hover { border-color: var(--brand); }


/* ── мотивационный виджет дневного прогресса ── */
.motiv{margin:14px 0 6px;padding:16px 18px;border:1px solid var(--border);border-radius:16px;background:linear-gradient(135deg,rgba(99,102,241,.06),rgba(16,185,129,.05));}
.motiv.unlocked{border-color:#10b981;background:linear-gradient(135deg,rgba(16,185,129,.12),rgba(16,185,129,.04));}
.motiv.excellent{border-color:#f59e0b;background:linear-gradient(135deg,rgba(245,158,11,.15),rgba(99,102,241,.06));}
.motiv-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;}
.motiv-title{font-weight:800;font-size:1.05rem;color:var(--text);}
.motiv-badge{font-weight:700;font-size:.76rem;color:var(--brand);background:rgba(99,102,241,.1);padding:4px 10px;border-radius:999px;white-space:nowrap;}
.motiv.unlocked .motiv-badge{color:#0a8f5f;background:rgba(16,185,129,.14);}
.motiv-bar{position:relative;height:24px;margin:12px 0 10px;border-radius:999px;background:var(--border);overflow:hidden;}
.motiv-bar>span{position:absolute;top:0;left:0;bottom:0;height:100%;border-radius:999px;background:linear-gradient(90deg,#6366f1,#8b5cf6);transition:width .6s cubic-bezier(.4,0,.2,1);}
.motiv.unlocked .motiv-bar>span{background:linear-gradient(90deg,#10b981,#34d399);}
.motiv-bar>em{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;font-style:normal;font-weight:700;font-size:.74rem;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.25);}
.motiv-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;}
.motiv-streak{display:inline-flex;align-items:center;gap:6px;font-weight:700;font-size:.9rem;color:var(--text);background:rgba(245,158,11,.12);padding:5px 11px;border-radius:999px;}
.motiv-streak.muted{color:var(--muted);background:var(--border);}
.motiv-streak .fire{font-size:1.05rem;}
.motiv-streak b{color:#f59e0b;font-size:1.05rem;}
.motiv-sub{flex:1;min-width:180px;color:var(--muted);font-size:.86rem;font-weight:500;}
.motiv-mini{display:flex;gap:14px;flex-wrap:wrap;margin-top:10px;font-size:.78rem;color:var(--muted);}
.motiv-mini b{color:var(--text);}

.motiv-streak.alt{color:var(--text);background:rgba(99,102,241,.10);}
.motiv-streak.alt b{color:var(--brand);}
.motiv-streak.excellent{color:#7c4a03;background:rgba(245,158,11,.17);}
.motiv-streak.excellent b{color:#b45309;}

.result-achievement {
  margin:0 0 16px; padding:15px 18px; border:1px solid rgba(245,158,11,.5);
  border-radius:14px; color:#7c4a03; background:linear-gradient(135deg,#fff7d6,#fff);
  text-align:center; font-size:.96rem; box-shadow:0 8px 24px rgba(245,158,11,.14);
}
.result-achievement b { font-weight:900; }

/* Телебаллы: баннер начисления на экране итогов блока */
.tv-award {
  background:linear-gradient(135deg,#5451e7 0%,#a23ce0 100%);
  color:#fff; border-radius:14px; padding:14px 18px; margin:0 0 16px;
  font-size:1.05rem; text-align:center; box-shadow:0 8px 24px rgba(84,81,231,0.28);
  animation:tvpop 0.4s ease;
}
.tv-award b { font-weight:900; }
@keyframes tvpop { from { transform:scale(0.9); opacity:0; } to { transform:scale(1); opacity:1; } }
