main { max-width: 1000px; margin: 0 auto; }

/* ===== Заголовок + обложка ===== */
.fanfic-top {
  display: grid; grid-template-columns: 1fr 260px; gap: 18px; align-items: start; margin-bottom: 16px;
}
@media (max-width: 760px) { .fanfic-top { grid-template-columns: 1fr; } }

/* Персиковые карточки */
.fanfic-cover-block,
.info-card,
.toc-item {
  background: #FFF4EC;
  border: 1px solid #FAD9C3;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(17,24,39,.06);
}
.fanfic-cover-block { padding: 12px; }
.info-card { padding: 16px 18px; }
.toc-item  { padding: 10px 12px; }

.dark-theme .fanfic-cover-block,
.dark-theme .info-card,
.dark-theme .toc-item {
  background:#3A2F2A;
  border-color:#6A5144;
  box-shadow: 0 10px 28px rgba(0,0,0,.32);
}

.fanfic-cover-thumb {
  width: 100%; max-width: 240px; max-height: 280px; object-fit: contain; border-radius: 10px; cursor: zoom-in; display:block; margin: 0 auto;
}
.fanfic-cover-block figcaption { font-size: .9rem; color: #6b7280; text-align: center; margin-top: 8px; }
.dark-theme .fanfic-cover-block figcaption { color: #cfd4dd; }

.cover-actions{
  margin-top:10px;
  display:flex; justify-content:center; align-items:center; gap:10px; flex-wrap:wrap; position:relative;
}
.btn-md{ padding:10px 16px !important; min-height:40px !important; font-size:.95rem !important; border-radius:10px; }
.button.danger{ background:#dc2626; color:#fff; border-color:#fecaca; }
.button.danger:hover{ background:#b91c1c; }

.stack { display: grid; gap: 16px; }

.info-card h3 {
  margin: 0 0 10px; font-size: 1.1rem; line-height: 1.25;
  padding-bottom: 8px; border-bottom: 1px dashed #FAD9C3;
}
.dark-theme .info-card h3 { border-bottom-color: #6A5144; }

.meta-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 10px 14px;
}
.meta-grid .label { color:#6b7280; }
.dark-theme .meta-grid .label { color:#cfd4dd; }
.meta-grid .value { font-weight: 700; min-width: 0; }

/* Модалка */
.modal { position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,.72); display: none; align-items: center; justify-content: center; padding: 24px; }
.modal.open { display: flex; }
.modal img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 12px; background: #000; }

/* Содержание */
.toc-card { margin-top: 12px; }
.toc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }

.toc-item { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.toc-item:hover { border-color: #F7C9AA; }

.toc-num { color:#6b7280; min-width: 60px; font-variant-numeric: tabular-nums; }
.dark-theme .toc-num { color:#d2d6de; }

.toc-link{
  display:block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none; font-weight: 700; color:#111827;
}
.toc-link:focus-visible{ outline: 2px solid #fbbf24; outline-offset: 2px; border-radius:6px; }
.toc-link:hover{ text-decoration: underline; text-underline-offset: 2px; }
.dark-theme .toc-link{ color:#f3f4f6; }

/* Лайки */
.like-control{ display:inline-flex; align-items:center; }
.like-btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px; min-height:36px; border-radius:10px;
  border:1px solid #e5e7eb; background:#f9fafb; color:#111827;
  cursor:pointer; font-weight:700; transition: background-color .15s ease, transform .1s ease;
}
.like-btn:hover{ background:#eef2ff; transform: translateY(-1px); }
.like-btn:focus-visible{ outline: 2px solid #93c5fd; outline-offset: 2px; }
.like-btn.liked{ background:#fee2e2; color:#991b1b; border-color:#fecaca; }
.like-btn.liked .like-divider{ background:#fca5a5; opacity:.9; }
.like-btn.liked .like-count{ color:#7f1d1d; }
.like-icon{ font-size:1rem; line-height:1; }
.like-divider{ width:1px; height:16px; background:#e5e7eb; opacity:.9; display:inline-block; }
.like-count{ font-size:.95rem; color:#6b7280; font-variant-numeric: tabular-nums; min-width: 1.6em; text-align:right; }
.dark-theme .like-btn{ border-color:#555; background:#3a3a55; color:#e5e7eb; }
.dark-theme .like-btn:hover{ background:#343454; }
.dark-theme .like-btn.liked{ background:#552b2b; color:#fecaca; border-color:#7f1d1d; }
.dark-theme .like-count{ color:#cbd5e1; }
.dark-theme .like-divider{ background:#6b7280; opacity:.5; }

/* Подписки */
.sub-control{ display:inline-flex; align-items:center; }
.sub-btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px; min-height:36px; border-radius:10px;
  border:1px solid #e5e7eb; background:#fff7ed; color:#7c2d12;
  cursor:pointer; font-weight:700; transition: background-color .15s ease, transform .1s ease;
}
.sub-btn:hover{ background:#ffedd5; transform: translateY(-1px); }
.sub-btn:focus-visible{ outline: 2px solid #fcd34d; outline-offset: 2px; }
.sub-btn.subscribed{ background:#dcfce7; color:#065f46; border-color:#a7f3d0; }
.sub-btn.subscribed .sub-divider{ background:#99f6e4; opacity:.9; }
.sub-btn.subscribed .sub-count{ color:#065f46; }
.sub-divider{ width:1px; height:16px; background:#f1c59c; opacity:.9; display:inline-block; }
.sub-count{ font-size:.95rem; font-variant-numeric: tabular-nums; min-width:1.6em; text-align:right; color:#6b7280; }
.dark-theme .sub-btn{ border-color:#555; background:#3a2f1f; color:#fde68a; }
.dark-theme .sub-btn:hover{ background:#4a3b25; }
.dark-theme .sub-btn.subscribed{ background:#174236; color:#a7f3d0; border-color:#065f46; }
.dark-theme .sub-count{ color:#cbd5e1; }
.dark-theme .sub-divider{ background:#6b7280; opacity:.5; }

/* Пэйринги и текст */
.pair-block,
.pair-block *,
.pair-mark,
.pair-mark * {
  text-transform: none !important;
  font-variant-caps: normal !important;
}
.pair-block { line-height: 1.6; }
.pair-mark{
  display: inline;
  padding: 0 4px;
  border-radius: 4px;
  background: #f5e0c6;
  box-shadow: inset 0 0 0 1px rgba(160, 120, 60, .25);
}
.dark-theme .pair-mark{
  background: #8b3801;
  box-shadow: inset 0 0 0 1px rgba(0, 17, 252, 0.35);
}
.pair-sep{ margin: 0 4px; color:#9ca3af; }

/* Quill-рендер */
.ql-view{
  line-height: 1.7;
  font-size: 1rem;
  color:#111827;
  word-break: break-word;
}
.dark-theme .ql-view{ color:#e5e7eb; }

.ql-view p{ margin: .6em 0; }
.ql-view h1, .ql-view h2, .ql-view h3{ line-height: 1.25; margin: .9em 0 .5em; }
.ql-view h1{ font-size: 1.6rem; }
.ql-view h2{ font-size: 1.35rem; }
.ql-view h3{ font-size: 1.2rem; }

.ql-view ul, .ql-view ol{ padding-left: 1.3em; margin: .6em 0; }
.ql-view li{ margin: .3em 0; }

.ql-view blockquote{
  margin: .8em 0; padding: .6em .9em;
  background:#fff1e8; border-left: 4px solid #FAD9C3; border-radius: 10px;
  color:#374151;
}
.dark-theme .ql-view blockquote{
  background:#3a312b; border-left-color:#6A5144; color:#e2e6ee;
}

.ql-view code{ background:#f3f4f6; padding:.1em .35em; border-radius:4px; }
.dark-theme .ql-view code{ background:#3a3a55; }
.ql-view pre{ background:#f3f4f6; padding:.8em 1em; border-radius:10px; overflow:auto; border:1px solid #e5e7eb; }
.ql-view pre code{ background:transparent; padding:0; }
.dark-theme .ql-view pre{ background:#2f3045; border-color:#555; }

.ql-view .ql-align-center { text-align: center; }
.ql-view .ql-align-right  { text-align: right; }
.ql-view .ql-align-justify{ text-align: justify; }

.ql-view img{ max-width:100%; height:auto; display:block; margin:.5em 0; }
.ql-view a{ text-decoration: underline; text-underline-offset: 2px; }

/* ======= Статус ======= */
.status-badge{
  display:inline-flex; align-items:center; gap:8px; font-weight:800; letter-spacing:.2px;
  padding:8px 12px; border-radius:999px; border:1px solid transparent; font-size:.95rem;
}
.status-badge .ico{ font-size:1rem; line-height:1; }
.status--done{
  background:#E8F8EE; border-color:#16A34A; color:#065F46;
}
.dark-theme .status--done{
  background:#0F2B22; border-color:#22C55E; color:#B8F7E7;
}
.status--progress{
  background:#FFE7D1; border-color:#FB923C; color:#7C2D12;
}
.dark-theme .status--progress{
  background:#3E2B1F; border-color:#F97316; color:#FFD6B3;
}
.status--frozen{
  background:#E0F2FE; border-color:#93C5FD; color:#1E3A8A;
}
.dark-theme .status--frozen{
  background:#0b2542; border-color:#1d4ed8; color:#93c5fd;
}

/* Панель выбора статуса */
.status-edit-btn{ position:relative; }

.status-panel{
  position:absolute; z-index:50; top:100%; left:0;
  margin-top:8px; padding:10px;
  min-width:260px; border-radius:12px;
  background:#fff; border:1px solid #e5e7eb; box-shadow:0 12px 28px rgba(0,0,0,.15);
}
.dark-theme .status-panel{
  background:#1f1f2e; border-color:#3e3e58; box-shadow:0 14px 34px rgba(0,0,0,.5);
}
.status-panel__title{
  font-weight:800; margin-bottom:8px; color:#111827;
}
.dark-theme .status-panel__title{ color:#e5e7eb; }

.status-option{
  display:flex; align-items:center; gap:10px; padding:6px; border-radius:10px; cursor:pointer;
}
.status-option:hover{
  background:#f3f4f6;
}
.dark-theme .status-option:hover{
  background:#2b2f4a;
}
.status-option input[type="radio"]{
  accent-color:#1a73e8;
}
.status-chip{
  display:inline-flex; align-items:center; gap:8px; font-weight:800; padding:6px 10px; border-radius:999px; border:1px solid transparent;
  font-size:.9rem;
}
.status-chip .ico{ opacity:.9; }
.status-chip.status--done{ background:#E8F8EE; border-color:#16A34A; color:#065F46; }
.dark-theme .status-chip.status--done{ background:#0F2B22; border-color:#22C55E; color:#B8F7E7; }
.status-chip.status--progress{ background:#FFE7D1; border-color:#FB923C; color:#7C2D12; }
.dark-theme .status-chip.status--progress{ background:#3E2B1F; border-color:#F97316; color:#FFD6B3; }
.status-chip.status--frozen{ background:#E0F2FE; border-color:#93C5FD; color:#1E3A8A; }
.dark-theme .status-chip.status--frozen{ background:#0b2542; border-color:#1d4ed8; color:#93c5fd; }

.status-panel__actions{
  display:flex; gap:8px; justify-content:flex-end; margin-top:8px;
}

/* Доп. блоки */
.fandom-block{
  font-weight:700;
}

/* ======= KPI-сводка ======= */
.kpi-grid{
  display:grid; grid-template-columns: repeat(3, 1fr); gap:12px;
}
.kpi{
  text-align:center; padding:12px; border-radius:12px;
  background:#fff; border:1px solid #FAD9C3;
  box-shadow: 0 4px 14px rgba(17,24,39,.05);
}
.kpi-num{ font-size:1.4rem; font-weight:800; line-height:1; }
.kpi-label{ font-weight:700; color:#6b7280; margin-top:4px; }
.dark-theme .kpi{
  background:#1f1f2e; border-color:#6A5144; box-shadow: 0 6px 18px rgba(0,0,0,.32);
}
.dark-theme .kpi-label{ color:#cfd4dd; }