:root {
  --brand: #5451e7; --brand-dark: #3d3ab0;
  --text: #1a1a2e; --muted: #6b7280;
  --bg: #f7f8ff; --card: #ffffff;
  --border: rgba(84, 81, 231, 0.13);
  --green: #36b26b; --red: #e0455a; --orange: #FF6B2B;
}

main { max-width: 1060px; margin: 0 auto; padding: 26px 4% 80px; }
.screen { display: none; }
.screen.on { display: block; animation: rise 0.25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#scr-item.on { animation: none; }

.page-title { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.02em; margin-bottom: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
       padding: 11px 20px; border-radius: 11px; border: none; cursor: pointer;
       font-family: inherit; font-size: 0.92rem; font-weight: 700; text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn:disabled { opacity: 0.45; cursor: default; }

/* вход */
.gate-card { max-width: 430px; margin: 8vh auto 0; background: var(--card); border: 1px solid var(--border);
             border-radius: 20px; padding: 34px; text-align: center; box-shadow: 0 14px 40px rgba(84,81,231,0.10); }
.gate-emoji { font-size: 2.6rem; margin-bottom: 8px; }
.gate-card h1 { font-size: 1.4rem; font-weight: 900; margin-bottom: 8px; }
.gate-card p { color: var(--muted); font-size: 0.92rem; margin-bottom: 18px; }

/* участник */
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.who-label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.chip { border: 1.5px solid var(--border); background: #fff; color: var(--text); border-radius: 18px;
        padding: 6px 15px; font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; }
.chip.sel { background: var(--brand); border-color: var(--brand); color: #fff; }

/* полка */
.book-card { display: flex; gap: 18px; align-items: center; background: var(--card);
             border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px;
             margin-bottom: 12px; cursor: pointer; transition: all 0.15s; width: 100%;
             text-align: left; font: inherit; }
.book-card:hover { border-color: var(--brand); box-shadow: 0 8px 26px rgba(84,81,231,0.12); }
.book-cover { font-size: 2rem; }
.book-info { flex: 1; min-width: 0; }
.book-title { font-weight: 800; font-size: 1.02rem; }
.book-author { color: var(--muted); font-size: 0.82rem; }
.book-stats { color: var(--muted); font-size: 0.78rem; margin-top: 4px; }
.pbar { height: 6px; border-radius: 4px; background: #eef0fb; overflow: hidden; margin-top: 8px; }
.pbar i { display: block; height: 100%; background: var(--green); }

/* оглавление */
.back-link { background: none; border: none; color: var(--brand); font: inherit; font-size: 0.85rem;
             font-weight: 700; cursor: pointer; padding: 0; margin-bottom: 10px; }
.toc-author { color: var(--muted); font-size: 0.88rem; margin: -6px 0 8px; }
.toc-progress { color: var(--muted); font-size: 0.8rem; margin-bottom: 16px; }
.toc-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
            background: var(--card); border: 1px solid var(--border); border-radius: 12px;
            padding: 11px 16px; margin-bottom: 7px; cursor: pointer; font: inherit; transition: border-color 0.12s; }
.toc-item:hover { border-color: var(--brand); }
.toc-item .mark { width: 22px; text-align: center; flex-shrink: 0; }
.toc-item .mark.done { color: var(--green); font-weight: 900; }
.toc-item .t { flex: 1; min-width: 0; font-weight: 600; font-size: 0.92rem; }
.toc-item.chapter { background: #f1f0fd; border-color: #d8d6f6; }
.toc-item.chapter .t { font-weight: 800; }
.toc-item .sub { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }

/* элемент */
.item-title { font-size: 1.3rem; font-weight: 900; letter-spacing: -0.01em; margin-bottom: 2px; }
.item-meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 16px; }

/* текстовая глава */
#text-view { max-width: 720px; }
#text-view p { margin-bottom: 14px; font-size: 1.0rem; line-height: 1.75; font-weight: 400; }

/* партия */
.game-layout { display: grid; grid-template-columns: minmax(280px, 480px) minmax(300px, 1fr);
               gap: 26px; align-items: start; }
.board-col { position: sticky; top: 80px; }
.board-wrap { background: #f0e7d5; border-radius: 14px; padding: 8px; }
.board-wrap > div { max-width: 100% !important; }
.board-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 12px; }
.board-nav .nav-btn { width: 52px; height: 44px; border-radius: 11px; border: 1.5px solid var(--brand);
                      background: #fff; color: var(--brand); font-size: 1rem; cursor: pointer; }
#move-label { font-weight: 800; font-size: 0.95rem; min-width: 90px; text-align: center; }

.notation-col { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
                padding: 18px 20px; font-size: 0.98rem; line-height: 1.85;
                max-height: calc(100vh - 140px); overflow-y: auto; }
.notation-col .mv { cursor: pointer; font-weight: 700; padding: 1px 4px; border-radius: 5px; white-space: nowrap; }
.notation-col .mv:hover { background: #eef0fb; }
.notation-col .mv.cur { background: var(--brand); color: #fff; }
.notation-col .mvno { color: var(--muted); font-weight: 600; }
.notation-col .cmt { color: #3f4a5a; font-weight: 400; }
.notation-col .nag { color: var(--orange); font-weight: 800; }
.notation-col .var { color: var(--muted); font-size: 0.92rem; }
.notation-col .var .mv { font-weight: 600; }
.notation-col .var-block { display: block; margin: 4px 0 4px 14px; padding-left: 10px;
                           border-left: 2px solid #e3e1fb; }

.item-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px;
                flex-wrap: wrap; margin-top: 26px; }
.done-btn { background: #fff; color: var(--green); border: 2px solid var(--green); }
.done-btn.is-done { background: var(--green); color: #fff; }
.pager { display: flex; gap: 10px; }

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

@media (max-width: 860px) {
  .game-layout { grid-template-columns: 1fr; }
  .board-col { position: static; max-width: min(92vw, 440px); margin: 0 auto; }
  .notation-col { max-height: none; }
}
