/* Модуль «Разбор партий» — стили. Дизайн-система innochess (Geologica, #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;
  --yellow: #eab308; --yellow-light: #fefce8;
  --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);
}

html, body { touch-action: manipulation; }
button, a, input, textarea, select { touch-action: manipulation; }
main { max-width: 1080px; margin: 0 auto; padding: 28px 4% 80px; }
.screen { display: none; }
.screen.on { display: block; animation: rise 0.35s ease both; }
#scr-review.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.5rem, 4vw, 2.2rem); font-weight: 900; letter-spacing: -0.02em; margin-bottom: 6px; }
.page-sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 22px; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 20px; 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 24px; 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: 46px;
}
.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.warn { background: var(--white); color: var(--red); border: 1.5px solid var(--red); }
.btn.small { padding: 7px 14px; min-height: 36px; font-size: 0.82rem; border-radius: 9px; }
.btn:disabled { opacity: 0.45; cursor: default; }

.who { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.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); min-height: 42px; }
.chip.sel { background: var(--brand); border-color: var(--brand); color: var(--white); }

/* ── список партий ── */
.games-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.game-card { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 16px; padding: 16px 18px;
  cursor: pointer; text-align: left; font-family: inherit; transition: border-color 0.18s, transform 0.18s; }
.game-card:hover { border-color: var(--brand-mid); transform: translateY(-2px); }
.game-card .g-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.game-card .g-opp { font-weight: 800; font-size: 1rem; }
.game-card .g-res { font-weight: 900; font-size: 1rem; }
.g-res.win { color: var(--green); } .g-res.loss { color: var(--red); } .g-res.draw { color: var(--muted); }
.game-card .g-meta { color: var(--muted); font-size: 0.78rem; margin: 4px 0 10px; }
.g-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.g-badge { font-size: 0.72rem; font-weight: 800; padding: 3px 10px; border-radius: 20px; }
.g-badge.stage { background: var(--bg); color: var(--brand); }
.g-badge.acc { background: var(--green-light); color: var(--green); }
.g-badge.wait { background: var(--yellow-light); color: #a16207; }
.g-badge.err { background: var(--red-light); color: var(--red); }

/* ── добавление ── */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs .tab { flex: 1; padding: 10px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--white); font-family: inherit; font-weight: 700; cursor: pointer; }
.tabs .tab.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; border: 1.5px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 0.95rem; background: #fff; }
.form-row textarea { min-height: 140px; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.pgn-check { font-size: 0.85rem; min-height: 20px; margin-bottom: 8px; }
.pgn-check.ok { color: var(--green); font-weight: 700; }
.pgn-check.bad { color: var(--red); font-weight: 700; }

/* ── мастер разбора ── */
.stepper { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.step { flex: 1; min-width: 90px; text-align: center; font-size: 0.72rem; font-weight: 800; padding: 8px 4px;
  border-radius: 10px; background: var(--bg); color: var(--muted); border: 1.5px solid transparent; }
.step.cur { background: var(--brand); color: #fff; }
.step.done { background: var(--green-light); color: var(--green); }

.review-grid { display: grid; grid-template-columns: minmax(280px, 520px) minmax(260px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 800px) { .review-grid { grid-template-columns: 1fr; gap: 14px; } }
.board-wrap { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); touch-action: none; width: 100%; max-width: min(100%, 520px); }
.board-wrap > div { max-width: 100% !important; }

.nav-row { display: flex; gap: 8px; margin-top: 10px; align-items: center; justify-content: center; }
.nav-row .btn { min-height: 42px; padding: 8px 18px; }
.ply-info { font-size: 0.85rem; color: var(--muted); font-weight: 700; min-width: 70px; text-align: center; }

.moves-strip { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 0.88rem; font-weight: 600;
  line-height: 1.9; max-height: 150px; overflow-y: auto; margin-top: 10px; }
.moves-strip .mv { display: inline-block; padding: 0 5px; border-radius: 6px; cursor: pointer; }
.moves-strip .mv.cur { background: var(--brand); color: #fff; }
.moves-strip .mnum { color: var(--muted); font-weight: 500; }
.moves-strip .cls-inaccuracy { color: #a16207; }
.moves-strip .cls-mistake { color: var(--orange); font-weight: 800; }
.moves-strip .cls-blunder { color: var(--red); font-weight: 800; }
.moves-strip .marked { text-decoration: underline dotted var(--brand); }

.panel { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.panel h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 10px; }
.hint { font-size: 0.82rem; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }

/* анкета */
.scale-row { margin-bottom: 14px; }
.scale-row .lbl { font-size: 0.88rem; font-weight: 700; margin-bottom: 6px; display: block; }
.scale { display: flex; gap: 6px; }
.scale button { flex: 1; min-height: 44px; border-radius: 10px; border: 1.5px solid var(--border); background: #fff;
  font-family: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer; }
.scale button.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.yn { display: flex; gap: 8px; }
.yn button { flex: 1; min-height: 44px; border-radius: 10px; border: 1.5px solid var(--border); background: #fff;
  font-family: inherit; font-weight: 700; cursor: pointer; }
.yn button.sel { background: var(--brand); color: #fff; border-color: var(--brand); }

/* отметки этапа «сам» */
.mark-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.mark-btns button { min-height: 46px; border-radius: 10px; border: 1.5px solid var(--border); background: #fff;
  font-family: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; padding: 6px 8px; }
.mark-btns button:hover { border-color: var(--brand-mid); }
.mark-btns button { display: grid; grid-template-columns: 28px 1fr; text-align: left; align-items: center; }
.mark-btns button .stake-icon { grid-row: 1 / 3; font-size: 1.1rem; color: var(--brand); text-align: center; }
.mark-btns button small { color: var(--muted); font-size: 0.66rem; font-weight: 500; }
.mark-btns button.placed { border-color: var(--green); background: var(--green-light); }
.marks-list { display: flex; flex-direction: column; gap: 6px; }
.mark-item { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 10px;
  padding: 7px 10px; font-size: 0.82rem; }
.mark-item .m-ply { font-weight: 800; color: var(--brand); cursor: pointer; white-space: nowrap; }
.mark-item .m-txt { flex: 1; }
.mark-item button { background: none; border: none; color: var(--red); font-weight: 800; cursor: pointer; }

/* этап движка */
.eval-chart-wrap { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 10px; margin-bottom: 14px; }
.compare-banner { background: var(--orange-light); border: 1px solid var(--orange-mid); border-radius: 12px;
  padding: 12px 16px; font-weight: 800; margin-bottom: 14px; color: #9a3412; }
.km-list { display: flex; flex-direction: column; gap: 8px; }
.km-card { border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer; background: #fff; }
.km-card:hover { border-color: var(--brand-mid); }
.km-card .km-type { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.km-type.t-blunder, .km-type.t-decisive_mistake { color: var(--red); }
.km-type.t-missed_win { color: var(--orange); }
.km-type.t-turning { color: var(--brand); }
.km-type.t-only_move { color: #0e7490; }
.km-card .km-body { font-size: 0.85rem; margin-top: 2px; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stake-result { border: 1.5px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.stake-result b { font-size: 0.78rem; }
.stake-result span { color: var(--muted); font-size: 0.72rem; }
.stake-result.ok { border-color: var(--green); background: var(--green-light); }
.stake-result.near { border-color: var(--yellow); background: var(--yellow-light); }
.strength-card { border-left: 4px solid var(--green); background: var(--green-light); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.strength-card b { display: block; margin-bottom: 5px; font-size: 0.82rem; }
.strength-card span { display: block; font-size: 0.78rem; margin-top: 3px; }
.moment-trainer { border: 1.5px solid var(--brand); border-radius: 12px; padding: 12px; margin-bottom: 14px; background: #f3f3ff; }
.trainer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.trainer-head div { min-width: 0; }
.trainer-head b, .trainer-head span { display: block; }
.trainer-head span, .trainer-status { font-size: 0.76rem; color: var(--muted); }
.trainer-status { margin-top: 8px; min-height: 20px; color: var(--text); }
.trainer-actions { margin-top: 8px; }
.stat-tile { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.stat-tile .v { font-size: 1.25rem; font-weight: 900; color: var(--brand); }
.stat-tile .l { font-size: 0.7rem; color: var(--muted); font-weight: 600; }

/* выводы */
.concl-item { border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.concl-item select, .concl-item input { width: 100%; border: 1.5px solid var(--border); border-radius: 9px;
  padding: 8px 10px; font-family: inherit; font-size: 0.88rem; margin-top: 6px; background: #fff; }

/* отчёт */
.report-sec { margin-bottom: 22px; }
.report-sec h3 { font-size: 1rem; font-weight: 800; margin-bottom: 8px; color: var(--brand); text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.1em; }
.intake-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.intake-chip { background: var(--bg); border-radius: 20px; padding: 5px 12px; font-size: 0.8rem; font-weight: 700; }

.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; }

/* мобильный фикс-бар мастера */
@media (max-width: 800px) {
  #scr-review.on .review-actions {
    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); padding: 10px 4% calc(10px + env(safe-area-inset-bottom));
    display: flex; gap: 8px;
  }
  #scr-review.on .review-actions .btn { flex: 1; }
  #scr-review.on { padding-bottom: 120px; }
}

/* ── тренды ── */
.trend-sec { margin-bottom: 20px; }
.trend-sec h3 { font-size: 0.78rem; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 0.85rem; }
.hbar-row .hb-label { flex: 0 0 130px; font-weight: 600; }
.hbar-row .hb-track { flex: 1; height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.hbar-row .hb-fill { height: 100%; background: var(--brand-mid); border-radius: 7px; }
.hbar-row .hb-val { flex: 0 0 44px; text-align: right; font-weight: 800; }
.trend-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.trend-table th { text-align: left; color: var(--muted); font-size: 0.7rem; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.trend-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); font-weight: 600; }

.file-drop { border: 2px dashed var(--brand-mid); border-radius: 14px; padding: 18px;
  text-align: center; cursor: pointer; background: var(--bg); margin-bottom: 12px;
  font-size: 0.92rem; color: var(--muted); transition: background 0.15s, border-color 0.15s; }
.file-drop:hover, .file-drop.over { background: #eef2ff; border-color: var(--brand); }
.file-drop b { color: var(--brand); }

@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(280deg); opacity: 0.7; }
}
.step.clickable { cursor: pointer; }
.step.clickable:hover { border-color: var(--brand-mid); }
.mark-item .m-cmt { background: none; border: none; cursor: pointer; font-size: 0.9rem; }
