/* ============================================================
   Писатели и эпохи — визуальная система
   Тёплая бумага, литературная типографика, архивная точность.
   ============================================================ */

:root {
  --paper: #f2ede3;
  --paper-2: #f7f2e8;
  --paper-3: #fbf8f1;
  --paper-deep: #e9e1d4;
  --paper-deep-2: #e2d8c7;
  --ink: #29251f;
  --ink-2: #3e382f;
  --ink-soft: #574f43;
  --muted: #71695c;
  --muted-2: #82796b;
  --line: #d9cfbf;
  --line-soft: #e3dbce;
  --line-strong: #bdb19f;
  --accent: #b24931;
  --accent-dark: #8e3622;
  --accent-soft: #e6c2b6;
  --blue: #3d6773;
  --green: #6e7e55;
  --rose: #b0566a;
  --shadow-soft: 0 14px 34px -24px rgba(45, 38, 29, .5);
  --shadow-card: 0 18px 38px -28px rgba(45, 38, 29, .5);
  --sans: 'Manrope', 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --display: 'Montserrat', 'Manrope', sans-serif;
  --sidebar-w: clamp(364px, 29.4vw, 416px);
  --rail-w: 186px;
  --radius: 3px;
  --fast: 160ms ease;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: .34;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.09'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

::selection { background: var(--accent-soft); color: var(--ink); }

button, input { font: inherit; }
button { color: inherit; }
button, [role='button'] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button { cursor: pointer; }

svg { display: block; }

.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

/* ============================================================
   ЛЕВАЯ ПАНЕЛЬ
   ============================================================ */

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100%;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(120% 70% at 0 0, rgba(255,255,255,.62), transparent 55%),
    linear-gradient(180deg, var(--paper-2), #f2ecdf 60%, #ece4d6);
  box-shadow: 18px 0 44px -48px rgba(44, 36, 26, .65);
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 21px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  overscroll-behavior: contain;
}

.sidebar-scroll::-webkit-scrollbar { width: 7px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #c9bdab; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

.sheet-handle { display: none; }

.brand-block { padding: 2px 2px 0; }

.brand-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  margin-bottom: 12px;
}

.brand-eyebrow,
.brand-period,
.section-kicker,
.year-caption,
.legend-kicker,
.popover-kicker,
.modal-eyebrow,
.scenario-audience,
.timeline-kicker,
.progress-note {
  font-size: 8.5px;
  line-height: 1.2;
  letter-spacing: .17em;
  text-transform: uppercase;
  font-weight: 700;
}

.brand-eyebrow { color: var(--accent-dark); }
.brand-period { color: var(--muted-2); font-family: var(--display); letter-spacing: .1em; }

.brand-title {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(37px, 3.2vw, 44px);
  line-height: .94;
  letter-spacing: -.045em;
  color: var(--ink);
}

.brand-title span,
.brand-title em { display: block; }
.brand-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-dark);
  padding-left: 22px;
  margin-top: 1px;
}

.manifesto {
  position: relative;
  margin: 0 0 14px;
  padding: 12px 0 12px 13px;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-size: 13.5px;
  line-height: 1.52;
  color: var(--ink-2);
  max-width: 345px;
}
.manifesto em { color: var(--ink); font-style: italic; }

.brand-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 15px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: .02em;
}
.brand-meta b { color: var(--ink-2); font-weight: 700; }
.meta-sep { width: 1px; height: 9px; background: var(--line-strong); }

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 2px 9px;
}

.section-kicker { display: block; color: var(--accent-dark); margin-bottom: 4px; }
.panel-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -.02em;
}
.author-count {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  font-family: var(--display);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.author-list { display: flex; flex-direction: column; }

.author-card {
  position: relative;
  padding: 14px 11px 13px;
  border-top: 1px solid var(--line-soft);
  border-left: 2px solid transparent;
  background: transparent;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
  content-visibility: auto;
  contain-intrinsic-size: 330px;
}
.author-card:hover {
  background: rgba(255, 252, 245, .74);
  border-left-color: var(--line-strong);
}
.author-card.is-connection-target { background: rgba(255, 252, 245, .86); }

.card-index {
  position: absolute;
  right: 10px;
  top: 13px;
  font-family: var(--display);
  font-size: 8.5px;
  color: var(--muted-2);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}

.card-head { display: flex; gap: 11px; align-items: flex-start; padding-right: 26px; }

.portrait-wrap {
  position: relative;
  flex: 0 0 56px;
  width: 56px;
  height: 70px;
  overflow: hidden;
  background: linear-gradient(145deg, #ded3c0, #efe7da);
  border: 1px solid #cfc3b1;
  box-shadow: 0 5px 12px -9px rgba(35, 28, 20, .75);
}
.portrait-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.22);
  pointer-events: none;
}
.portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
  filter: saturate(.78) sepia(.1) contrast(1.04);
  transition: filter .25s ease, transform .4s ease;
}
.author-card:hover .portrait-wrap img { filter: saturate(.93) sepia(.03) contrast(1.03); transform: scale(1.025); }
.portrait-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-family: var(--serif);
  font-size: 20px;
  color: var(--accent-dark);
  background: #e8dece;
}

.card-title-wrap { min-width: 0; padding-top: 1px; }
.card-years {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--display);
  font-size: 8.4px;
  font-weight: 600;
  letter-spacing: .11em;
  color: var(--muted);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  margin-bottom: 3px;
}
.card-years .life-line { width: 9px; height: 1px; background: var(--line-strong); }
.card-name {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 16.8px;
  line-height: 1.12;
  font-weight: 500;
  letter-spacing: -.025em;
  color: var(--ink);
}
.movement-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  color: var(--badge-color, var(--muted));
  font-size: 8.5px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}
.movement-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.tragic-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  color: var(--accent-dark);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .03em;
}
.tragic-badge span {
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 8px;
}

.card-bio {
  margin: 11px 0 11px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.card-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.card-section-label::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

.works-list { list-style: none; margin: 0; padding: 0; }
.work-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  padding: 2.5px 0;
  font-size: 10.7px;
  line-height: 1.28;
  color: var(--ink-soft);
}
.work-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-year {
  font-family: var(--display);
  font-size: 8.6px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.work-row.is-outside { opacity: .45; }

.card-connections {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}
.connection-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-soft);
  border-bottom: 1px dotted var(--line-strong);
  padding-bottom: 1px;
  transition: color var(--fast), border-color var(--fast);
}
.connection-chip:hover { color: var(--accent-dark); border-color: var(--accent); }
.connection-chip .relation-glyph { font-size: 8.5px; color: var(--muted); }

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  transition: gap var(--fast), color var(--fast);
}
.card-action .arrow { font-size: 12px; line-height: 1; transition: transform var(--fast); }
.card-action:hover { gap: 9px; color: var(--ink); }
.card-action:hover .arrow { transform: translateX(2px); }

/* Фокусная карточка */
.focus-host:empty { display: none; }
.focus-card {
  position: relative;
  margin: 16px 0 6px;
  padding: 15px 13px 14px;
  background: var(--paper-3);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-card);
  animation: focusIn .25s ease both;
}
@keyframes focusIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.focus-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}
.focus-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-dark);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.focus-label::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.focus-close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.focus-close:hover { color: var(--ink); border-color: var(--ink); background: var(--paper); }

.focus-head { display: flex; gap: 13px; align-items: flex-start; }
.focus-portrait {
  flex: 0 0 78px;
  width: 78px;
  height: 98px;
  object-fit: cover;
  object-position: center 20%;
  border: 1px solid var(--line-strong);
  filter: saturate(.82) sepia(.06);
  background: #e8dece;
}
.focus-name {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -.035em;
}
.focus-years {
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 7px;
  font-variant-numeric: tabular-nums;
}
.focus-portrait-source {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 7.5px;
  line-height: 1.3;
  text-decoration: none;
  border-bottom: 1px dotted var(--line-strong);
  transition: color var(--fast), border-color var(--fast);
}
.focus-portrait-source:hover { color: var(--accent-dark); border-color: var(--accent); }
.focus-bio { margin: 12px 0 13px; font-size: 11.5px; line-height: 1.58; color: var(--ink-soft); }
.focus-section { margin-top: 12px; }
.focus-section .card-section-label { margin-bottom: 7px; }
.focus-works .work-row { padding: 3px 0; font-size: 10.8px; }
.focus-relations { list-style: none; margin: 0; padding: 0; }
.focus-relation {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: baseline;
  padding: 3.5px 0;
  border-bottom: 1px dotted var(--line-soft);
  font-size: 9.6px;
  line-height: 1.35;
}
.focus-relation > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.focus-relation:last-child { border-bottom: 0; }
.focus-relation .rel-icon {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 8.5px;
  line-height: 1;
  color: var(--rel-color);
  background: var(--paper-3);
}
.focus-relation b { font-weight: 700; color: var(--ink-2); }
.focus-relation .rel-note { display: inline; margin-left: 4px; color: var(--muted); font-size: 7.8px; line-height: 1.3; }
.focus-relation .rel-other {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  border-bottom: 1px solid var(--line-strong);
  transition: color var(--fast), border-color var(--fast);
}
.focus-relation .rel-other:hover { color: var(--accent-dark); border-color: var(--accent); }
.focus-relation .rel-year {
  font-family: var(--display);
  font-size: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.focus-context { display: flex; flex-wrap: wrap; gap: 5px; }
.context-chip {
  padding: 4px 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-size: 8.5px;
  line-height: 1.2;
  text-align: left;
  transition: border-color var(--fast), background var(--fast), color var(--fast);
}
.context-chip:hover { border-color: var(--accent); color: var(--accent-dark); background: #f5e9e2; }
.focus-tragic {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 8px 9px;
  background: #f3e2db;
  border-left: 2px solid var(--accent);
  color: #6e2d1e;
  font-size: 9.5px;
  line-height: 1.4;
}
.focus-tragic .tragic-icon { font-size: 12px; line-height: 1.1; }
.focus-actions { display: flex; gap: 8px; align-items: center; margin-top: 13px; }
.focus-on-timeline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-3);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  transition: background var(--fast), border-color var(--fast);
}
.focus-on-timeline:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.focus-share {
  padding: 7px 2px;
  border: 0;
  border-bottom: 1px dotted var(--line-strong);
  background: transparent;
  font-size: 8.5px;
  color: var(--muted);
  letter-spacing: .03em;
  transition: color var(--fast), border-color var(--fast);
}
.focus-share:hover { color: var(--accent-dark); border-color: var(--accent); }
.focus-share code { font-family: var(--display); color: var(--ink-soft); }

.list-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}
.list-empty p { font-family: var(--serif); font-size: 16px; line-height: 1.35; margin: 8px 0 13px; color: var(--ink-soft); }
.empty-mark { font-size: 24px; color: var(--accent); }
.ghost-button {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: background var(--fast), border-color var(--fast);
}
.ghost-button:hover { background: var(--paper-3); border-color: var(--ink); }

.sidebar-footer {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  padding: 10px 21px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #f4eee3, #f0e9dc 34%);
}
.footer-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border: 0;
  background: transparent;
  text-align: left;
  transition: color var(--fast);
}
.footer-button:hover { color: var(--accent-dark); }
.footer-icon {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 12px;
  color: var(--accent-dark);
}
.footer-button b { display: block; font-size: 9.5px; letter-spacing: .02em; }
.footer-button small { display: block; margin-top: 1px; color: var(--muted); font-size: 8.5px; }

/* ============================================================
   ПРАВАЯ ЧАСТЬ: ШАПКА
   ============================================================ */

.main {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(72% 70% at 60% 0%, rgba(255,255,255,.4), transparent 60%),
    var(--paper);
}

.topbar {
  position: relative;
  z-index: 40;
  flex: 0 0 auto;
  padding: 13px 22px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(246,241,232,.92);
  backdrop-filter: blur(10px);
}

.topbar-primary {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 42px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 230px;
  max-width: 310px;
  height: 38px;
  padding: 0 10px 0 34px;
  border: 1px solid var(--line-strong);
  background: rgba(255,252,246,.72);
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
}
.search-wrap:focus-within {
  border-color: var(--ink-soft);
  background: var(--paper-3);
  box-shadow: 0 0 0 3px rgba(178,73,49,.08);
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.search-wrap input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: .01em;
}
.search-wrap input::placeholder { color: var(--muted-2); }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-clear {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}
.search-clear:hover { background: var(--accent-soft); color: var(--accent-dark); }
.search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 4px;
  border: 1px solid var(--line);
  color: var(--muted-2);
  font-family: var(--display);
  font-size: 8px;
  line-height: 1.4;
  pointer-events: none;
}
.search-wrap:focus-within .search-kbd { display: none; }

.sheet-toggle { display: none; }

.year-block {
  flex: 0 0 auto;
  min-width: 112px;
  padding: 0 9px 0 15px;
  border-left: 1px solid var(--line);
  transition: color var(--fast);
}
.year-caption {
  display: block;
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 7.5px;
  letter-spacing: .14em;
  transition: color var(--fast);
}
.year-line { display: flex; align-items: baseline; gap: 5px; }
.year-value {
  display: inline-block;
  min-width: 4ch;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.045em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: color var(--fast);
}
.year-suffix { font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
body.is-playing .year-block { color: var(--accent); }
body.is-playing .year-value,
body.is-playing .year-caption { color: var(--accent-dark); }

.play-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}
.play-button {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  min-width: 89px;
  padding: 0 13px 0 9px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-3);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.play-button:hover { background: var(--ink-2); border-color: var(--ink-2); }
.play-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
}
.play-icon svg { width: 12px; height: 12px; }
.play-icon .icon-pause { display: none; }
body.is-playing .play-button { background: var(--accent); border-color: var(--accent); }
body.is-playing .play-button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
body.is-playing .play-icon .icon-play { display: none; }
body.is-playing .play-icon .icon-pause { display: block; }

.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.icon-button svg { width: 16px; height: 16px; }
.icon-button:hover { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.36); }

.speed-switch {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--line);
  background: var(--paper-deep);
}
.speed-switch button {
  height: 24px;
  min-width: 31px;
  padding: 0 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--display);
  font-size: 8.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background var(--fast), color var(--fast);
}
.speed-switch button:hover { color: var(--ink); }
.speed-switch button.is-active { background: var(--paper-3); color: var(--ink); box-shadow: 0 1px 3px -2px rgba(40,32,24,.45); }

.topbar-secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  min-height: 30px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: rgba(255,252,246,.4);
  color: var(--ink-soft);
  font-size: 9.3px;
  font-weight: 600;
  letter-spacing: .015em;
  white-space: nowrap;
  transition: border-color var(--fast), background var(--fast), color var(--fast);
}
.filter-pill:hover { border-color: var(--line-strong); background: var(--paper-3); color: var(--ink); }
.filter-pill[aria-expanded='true'] { border-color: var(--ink-soft); background: var(--paper-3); }
.filter-pill.is-active { border-color: var(--accent-soft); background: #f5e5de; color: var(--accent-dark); }
.pill-count {
  display: grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 9px;
  background: var(--paper-deep);
  color: var(--muted);
  font-family: var(--display);
  font-size: 7.5px;
  font-variant-numeric: tabular-nums;
}
.filter-pill.is-active .pill-count { background: #edd1c4; color: var(--accent-dark); }
.pill-dots { display: inline-flex; gap: 2px; align-items: center; }
.pill-dots i { display: block; width: 4px; height: 4px; border-radius: 50%; }
.relation-mini { font-size: 12px; color: var(--blue); line-height: 1; }
.chevron { width: 11px; height: 11px; color: var(--muted); }

.tragic-pill-icon {
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 8px;
  color: var(--accent-dark);
}
.world-pill-line {
  display: block;
  width: 12px;
  height: 0;
  border-top: 1.5px dashed var(--blue);
}
.toggle-pill[aria-pressed='true'] { border-color: var(--line-strong); background: var(--paper-3); color: var(--ink); }
.toggle-pill[aria-pressed='true'] .world-pill-line { border-top-style: solid; }
.toggle-pill[aria-pressed='false'] { color: var(--muted-2); opacity: .7; }

.slowdown-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  margin-left: 3px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 8.5px;
  cursor: pointer;
  white-space: nowrap;
}
.slowdown-check input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui {
  position: relative;
  display: inline-block;
  flex: 0 0 25px;
  width: 25px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper-deep);
  transition: background var(--fast), border-color var(--fast);
}
.switch-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  transition: transform var(--fast), background var(--fast);
}
.slowdown-check input:checked + .switch-ui { background: var(--accent); border-color: var(--accent); }
.slowdown-check input:checked + .switch-ui::after { transform: translateX(11px); background: #fff8f1; }
.slowdown-check input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.text-button {
  height: 28px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: color var(--fast);
}
.text-button:hover { color: var(--accent-dark); }
.help-text-button { margin-left: auto; }

.popover-wrap { position: relative; }
.popover {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 110;
  width: 306px;
  padding: 13px;
  border: 1px solid var(--line-strong);
  background: var(--paper-3);
  box-shadow: 0 22px 45px -28px rgba(40,32,24,.62);
  animation: popIn .16s ease both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.popover-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.popover-kicker { color: var(--muted); font-size: 7.5px; }
.mini-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .02em;
}
.mini-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.check-list { display: flex; flex-direction: column; }
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 1px;
  color: var(--ink-soft);
  font-size: 10px;
  cursor: pointer;
  border-bottom: 1px dotted transparent;
}
.check-line:hover { color: var(--ink); }
.check-line input {
  appearance: none;
  width: 13px;
  height: 13px;
  margin: 0;
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  display: grid;
  place-items: center;
  flex: 0 0 13px;
  transition: background var(--fast), border-color var(--fast);
}
.check-line input:checked { background: var(--ink); border-color: var(--ink); }
.check-line input:checked::after { content: ''; width: 5px; height: 3px; border-left: 1.5px solid var(--paper-3); border-bottom: 1.5px solid var(--paper-3); transform: rotate(-45deg) translateY(-1px); }
.check-line .check-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; }
.check-line .check-count { margin-left: auto; font-family: var(--display); font-size: 8px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.check-line .check-icon { display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 50%; font-size: 8px; flex: 0 0 16px; }

.switch-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 9.5px;
  line-height: 1.35;
}
.switch-line small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.35; }
.switch-line input { position: absolute; opacity: 0; pointer-events: none; }
.switch-line .switch-ui { flex: 0 0 25px; margin-left: auto; }
.switch-line input:checked + .switch-ui { background: var(--blue); border-color: var(--blue); }
.switch-line input:checked + .switch-ui::after { transform: translateX(11px); background: #fff; }
.switch-line input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================
   ТАЙМЛАЙН
   ============================================================ */

.timeline-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), transparent 18%),
    var(--paper);
}

.timeline-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 31px;
  padding: 6px 22px 5px;
  border-bottom: 1px solid rgba(217,207,191,.55);
  color: var(--muted);
}
.timeline-caption-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 5px;
}
.timeline-kicker { color: var(--ink-soft); letter-spacing: .14em; font-size: 8px; white-space: nowrap; }
.timeline-hint { color: var(--muted-2); font-size: 8.5px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-hint { display: none; color: var(--muted-2); font-size: 7.5px; letter-spacing: .02em; white-space: nowrap; }
.timeline-hint.is-nudge { color: var(--accent-dark); }
.timeline-range { flex: 0 0 auto; padding-left: 8px; border-left: 1px solid var(--line); color: var(--muted); font-family: var(--display); font-size: 8px; letter-spacing: .06em; white-space: nowrap; }
.filter-fade { display: none; }
.play-status {
  display: inline-flex;
  margin-right: 118px;
  align-items: center;
  gap: 6px;
  color: var(--accent-dark);
  font-family: var(--display);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.play-status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: pulse 1.5s ease infinite; }
@keyframes pulse { 0%,100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.2); } }

.timeline-scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  touch-action: pan-x pan-y;
  scroll-behavior: auto;
  scrollbar-width: thin;
  scrollbar-color: #bfb29f transparent;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  cursor: grab;
}
.timeline-scroll.is-dragging { cursor: grabbing; }
.timeline-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.timeline-scroll::-webkit-scrollbar-track { background: transparent; }
.timeline-scroll::-webkit-scrollbar-thumb { background: #c8bcab; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

.timeline-world {
  display: flex;
  align-items: stretch;
  height: 100%;
  min-height: 100%;
  position: relative;
}

.author-rail {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 16;
  flex: 0 0 var(--rail-w);
  width: var(--rail-w);
  height: 100%;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(90deg, #f4efe5 82%, rgba(244,239,229,.94)),
    var(--paper-2);
  box-shadow: 13px 0 24px -25px rgba(40,32,24,.7);
}
.rail-author {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0 9px 0 13px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  text-align: left;
  color: var(--ink-soft);
  transition: background var(--fast), color var(--fast), opacity .2s ease;
  cursor: pointer;
  overflow: hidden;
}
.rail-author:hover { background: rgba(255,252,246,.7); color: var(--ink); }
.rail-author .rail-dot { flex: 0 0 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--rail-color); }
.rail-author .rail-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--rail-font, 10px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.01em;
}
.rail-author .rail-years {
  flex: 0 0 auto;
  margin-left: auto;
  font-family: var(--display);
  font-size: var(--rail-years-font, 7.5px);
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.author-rail.is-compact .rail-years { display: none; }
.rail-author .rail-tragic {
  flex: 0 0 11px;
  width: 11px;
  height: 11px;
  display: grid;
  place-items: center;
  border: 1px solid #b96752;
  border-radius: 50%;
  color: #8e3622;
  font-size: 7px;
  line-height: 1;
}
.rail-author.is-focused {
  color: var(--ink);
  background: #f7ece5;
  border-left-color: var(--accent);
  opacity: 1 !important;
}
.author-rail.is-filtered .rail-author { opacity: .24; }
.author-rail.is-filtered .rail-author.is-visible { opacity: 1; }

.timeline-svg {
  flex: 0 0 auto;
  height: 100%;
  overflow: visible;
  font-family: var(--sans);
  user-select: none;
  -webkit-user-select: none;
}
.timeline-svg text { pointer-events: none; }

.grid-line { stroke: #d7ccbd; stroke-width: .7; opacity: .54; }
.grid-line.decade { opacity: .82; }
.grid-line.century { stroke: #bfb19e; opacity: .9; }
.axis-rule { stroke: #b9ac9a; stroke-width: 1; }
.axis-year {
  fill: #756c5f;
  font-family: var(--display);
  font-size: var(--axis-font, 8.3px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.axis-year.is-century { fill: #4c4438; font-weight: 600; font-size: var(--axis-century-font, 9.2px); }
.axis-tick { stroke: #b9ac9a; stroke-width: 1; }

.timeline-svg.is-compact .author-line { stroke-width: var(--author-stroke, 2.2); }
.timeline-svg.is-compact .author-group:hover .author-line { stroke-width: var(--author-stroke-hover, 3.2); }
.author-group { transition: opacity .22s ease; }
.author-band { fill: transparent; transition: fill .16s ease; pointer-events: none; }
.author-band:hover { fill: rgba(255,252,245,.56); }
.author-guide {
  stroke: #cfc4b4;
  stroke-width: .55;
  stroke-dasharray: 1 4;
  opacity: .55;
  pointer-events: none;
}
.author-line {
  fill: none;
  stroke-width: var(--author-stroke, 3.1);
  stroke-linecap: round;
  transition: stroke-width .15s ease, opacity .2s ease;
}
.author-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 17;
  cursor: pointer;
}
.author-group:hover .author-line { stroke-width: var(--author-stroke-hover, 4.3); }
.author-cap { fill: var(--paper-3); stroke-width: 1.5; }
.author-open {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.work-dot {
  fill: var(--paper-3);
  stroke-width: 1.7;
  cursor: pointer;
  transition: r .12s ease, fill .16s ease, opacity .25s ease;
}
.work-dot:hover { r: 5.3; fill: #fff; }
.work-hit { fill: transparent; cursor: pointer; }
.work-label {
  fill: #51493e;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .01em;
  opacity: 0;
  transition: opacity .18s ease;
}
.author-group.is-focused .work-label { opacity: 1; }
.work-label-year { fill: #756c5f; font-family: var(--display); font-size: 7.3px; }

.tragic-marker { cursor: help; }
.tragic-marker .tragic-halo { fill: #b24931; opacity: .12; }
.tragic-marker .tragic-disc { fill: var(--paper-3); stroke: #9c3b27; stroke-width: 1; }
.tragic-marker .tragic-glyph { fill: #8e3622; font-size: 8px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }

.event-group { transition: opacity .22s ease; }
.event-line { stroke-width: 1.05; opacity: .66; }
.event-group:not(.is-major) .event-line { opacity: .24; }
.event-group:not(.is-major) .event-span { opacity: .018; }
.event-line.russia { stroke: #b24931; }
.event-line.world { stroke: #3d6773; stroke-dasharray: 4 4; opacity: .58; }
.event-span { opacity: .035; }
.event-span.russia { fill: #b24931; }
.event-span.world { fill: #3d6773; opacity: .025; }
.event-hit { stroke: transparent; stroke-width: 11; cursor: pointer; }
.event-group:hover .event-line { opacity: 1; stroke-width: 1.5; }
.event-group:hover .event-span { opacity: .075; }
.event-label { cursor: pointer; }
.event-label:focus { outline: none; }
.event-label:focus .event-label-bg { stroke: var(--accent); stroke-width: 1.5; }
.event-label-bg {
  fill: rgba(247,242,232,.97);
  stroke: rgba(190,179,161,.55);
  stroke-width: .6;
  transition: fill .15s ease, stroke .15s ease;
}
.event-group:hover .event-label-bg { fill: #fffaf1; stroke: #a99882; }
.event-label-text {
  fill: #554d41;
  font-size: var(--event-label-font, 8.25px);
  font-weight: 600;
  letter-spacing: .005em;
}
.event-label-year {
  fill: #776e60;
  font-family: var(--display);
  font-size: var(--event-year-font, 7.45px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.event-group.is-world .event-label-text { fill: #315964; }
.event-group.is-world .event-label-year { fill: #6d8b93; }
.event-group.is-major .event-label-text { font-weight: 700; }
.event-group.is-hidden-label .event-label { display: none; }

.relation-group { transition: opacity .22s ease; }
.relation-path {
  fill: none;
  stroke-width: 1.15;
  opacity: .4;
  pointer-events: none;
  transition: opacity .18s ease, stroke-width .18s ease;
}
.relation-hit { fill: none; stroke: transparent; stroke-width: 8; cursor: help; pointer-events: stroke; }
.relation-group:hover .relation-path { opacity: .88; stroke-width: 1.7; }
.relation-icon-disc { fill: var(--paper-3); stroke-width: 1; }
.relation-icon-text { font-size: 7.6px; text-anchor: middle; dominant-baseline: central; font-weight: 700; }
.relation-icon { cursor: help; }
.relation-group.is-focus-relation .relation-path { opacity: .82; stroke-width: 1.55; }

.play-cursor { pointer-events: none; opacity: 0; transition: opacity .18s ease; }
.play-cursor.is-visible { opacity: 1; }
.play-cursor .cursor-shadow { stroke: rgba(250,247,239,.92); stroke-width: 4.4; }
.play-cursor .cursor-line { stroke: url(#cursorGradient); stroke-width: 1.65; }
.play-cursor .cursor-diamond { fill: var(--ink); }
.play-cursor .cursor-year-bg { fill: var(--ink); }
.play-cursor .cursor-year-text { fill: var(--paper-3); font-family: var(--display); font-size: 8px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; }

.is-future { opacity: .15 !important; }
.is-past { opacity: 1; }
.author-group.is-future .author-line { opacity: .34; }
.author-group.is-future .author-cap { opacity: .3; }
.event-group.is-future .event-line { opacity: .08; }
.event-group.is-future .event-label { opacity: .16; }
.event-group.is-future .event-span { opacity: .008; }
.work-dot.is-future { opacity: .11; }
.relation-group.is-future { opacity: .06; }

.timeline-world.has-focus .author-group:not(.is-focused) { opacity: .2; }
.timeline-world.has-focus .author-group.is-focused .author-line { stroke-width: 4.8; }
.timeline-world.has-focus .author-group.is-focused .author-band { fill: rgba(255,252,245,.58); }
.timeline-world.has-focus .event-group { opacity: .44; }
.timeline-world.has-focus .rail-author:not(.is-focused) { opacity: .34; }
.timeline-world.has-focus .rail-author.is-focused { opacity: 1; }
.timeline-world.has-focus .relation-group:not(.is-focus-relation) { display: none; }

.timeline-empty {
  position: absolute;
  inset: 31px 0 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(242,237,227,.86);
  backdrop-filter: blur(3px);
}
.timeline-empty[hidden] { display: none; }
.timeline-empty-inner { max-width: 310px; text-align: center; }
.timeline-empty h3 { margin: 8px 0 6px; font-family: var(--serif); font-weight: 500; font-size: 23px; letter-spacing: -.02em; }
.timeline-empty p { margin: 0 0 14px; color: var(--muted); font-size: 11px; line-height: 1.5; }

/* Зум */
.zoom-controls {
  position: absolute;
  right: 14px;
  top: 2px;
  z-index: 34;
  display: flex;
  align-items: center;
  gap: 1px;
  height: 26px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  background: rgba(249,245,237,.94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(5px);
}
.zoom-button, .zoom-fit {
  display: grid;
  place-items: center;
  width: 24px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 15px;
  line-height: 1;
  transition: background var(--fast), color var(--fast);
}
.zoom-button:hover, .zoom-fit:hover { background: var(--paper-deep); color: var(--ink); }
.zoom-level {
  min-width: 28px;
  text-align: center;
  font-family: var(--display);
  font-size: 8px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.zoom-fit { border-left: 1px solid var(--line-soft); margin-left: 2px; }
.zoom-fit svg { width: 12px; height: 12px; }

/* Легенда */
.legend {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 33;
  display: flex;
  flex-direction: column-reverse;
  width: 300px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-bottom: 0;
  background: rgba(249,245,237,.97);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(7px);
  transition: width .2s ease;
}
.legend.is-collapsed { width: var(--rail-w); }
.legend-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  height: 32px;
  padding: 0 9px 0 11px;
  border: 0;
  background: transparent;
  text-align: left;
}
.legend-title { font-size: 8.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-soft); }
.legend-preview { display: flex; gap: 3px; margin-left: 8px; }
.legend-preview i { display: block; width: 4px; height: 4px; border-radius: 50%; }
.legend-toggle .chevron { margin-left: auto; transition: transform var(--fast); }
.legend-toggle[aria-expanded='true'] .chevron { transform: rotate(180deg); }
.legend-body { max-height: min(47vh, 390px); overflow-y: auto; padding: 2px 12px 12px; border-top: 1px solid var(--line-soft); }
.legend.is-collapsed .legend-preview { opacity: .85; }
.legend-section { padding-top: 10px; }
.legend-kicker { display: block; color: var(--muted); font-size: 7.2px; letter-spacing: .14em; margin-bottom: 6px; }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.legend-item { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--ink-soft); font-size: 8.5px; line-height: 1.25; }
.legend-item i { flex: 0 0 5px; width: 5px; height: 5px; border-radius: 50%; }
.legend-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-relations .legend-item { gap: 4px; }
.legend-rel-icon {
  display: grid;
  place-items: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 7.5px;
  line-height: 1;
}
.legend-notes { display: flex; flex-wrap: wrap; gap: 5px 12px; color: var(--ink-soft); font-size: 8px; }
.legend-notes div { display: flex; align-items: center; gap: 5px; }
.legend-swatch { width: 12px; height: 0; border-top: 1.5px solid; }
.legend-swatch.event-russia { border-color: #b24931; }
.legend-swatch.event-world { border-color: #3d6773; border-top-style: dashed; }
.legend-tragic {
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border: 1px solid #9c3b27;
  border-radius: 50%;
  color: #8e3622;
  font-size: 7.5px;
}
.legend-note { margin: 10px 0 0; padding-top: 8px; border-top: 1px dotted var(--line); color: var(--muted); font-size: 7.6px; line-height: 1.45; }

/* Тултипы и поповеры таймлайна */
.chart-tooltip {
  position: absolute;
  z-index: 80;
  max-width: 270px;
  padding: 8px 10px;
  background: var(--ink);
  color: var(--paper-3);
  box-shadow: 0 12px 28px -15px rgba(30,24,17,.65);
  pointer-events: none;
  animation: tooltipIn .1s ease both;
}
@keyframes tooltipIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.chart-tooltip .tt-kicker { display: block; margin-bottom: 3px; color: #cfbea9; font-size: 7px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.chart-tooltip .tt-title { display: block; font-family: var(--serif); font-size: 13px; line-height: 1.25; font-weight: 500; }
.chart-tooltip .tt-meta { display: block; margin-top: 4px; color: #cbbba5; font-size: 8.5px; line-height: 1.35; }
.chart-tooltip .tt-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }

.event-card {
  position: absolute;
  z-index: 60;
  width: 300px;
  padding: 14px 15px 13px;
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--event-color, var(--accent));
  background: var(--paper-3);
  box-shadow: 0 20px 44px -24px rgba(40,32,24,.65);
  animation: popIn .16s ease both;
}
.event-card[hidden] { display: none; }
.event-card-close {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
}
.event-card-close:hover { color: var(--ink); }
.event-card .ec-kicker { display: flex; align-items: center; gap: 6px; color: var(--event-color); font-size: 7.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; margin-bottom: 5px; }
.event-card h3 { margin: 0 0 7px; padding-right: 18px; font-family: var(--serif); font-size: 18px; line-height: 1.14; font-weight: 500; letter-spacing: -.02em; }
.event-card .ec-years { color: var(--muted); font-family: var(--display); font-size: 8.5px; letter-spacing: .04em; margin-bottom: 7px; font-variant-numeric: tabular-nums; }
.event-card p { margin: 0; color: var(--ink-soft); font-size: 10.8px; line-height: 1.5; }
.event-card .ec-authors { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 9.2px; line-height: 1.45; }
.ec-authors b { color: var(--ink-soft); font-weight: 600; }
.ec-authors button { border: 0; background: none; padding: 0; color: var(--ink-soft); border-bottom: 1px dotted var(--line-strong); font-size: inherit; }
.ec-authors button:hover { color: var(--accent-dark); }

.slow-toast {
  position: absolute;
  top: 43px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid #d4a18e;
  background: rgba(251,242,235,.98);
  color: var(--accent-dark);
  box-shadow: var(--shadow-soft);
  animation: slowIn .25s ease both;
}
.slow-toast[hidden] { display: none; }
.slow-toast-icon { font-size: 14px; }
.slow-toast b { display: block; font-size: 8px; letter-spacing: .12em; text-transform: uppercase; }
.slow-toast small { display: block; margin-top: 1px; color: var(--ink-soft); font-size: 8.5px; }
@keyframes slowIn { from { opacity: 0; transform: translate(-50%, -5px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Прогресс */
.progress-wrap {
  flex: 0 0 48px;
  padding: 7px 22px 8px;
  border-top: 1px solid var(--line);
  background: rgba(242,236,225,.84);
}
.progress-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--muted-2);
  font-family: var(--display);
  font-size: 7px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .05em;
}
.progress-note { margin: 0 auto; color: var(--muted); letter-spacing: .12em; font-size: 7px; }
.progress-year:last-child { margin-left: auto; }
.progress {
  position: relative;
  height: 10px;
  cursor: pointer;
  touch-action: none;
}
.progress-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 3px;
  height: 4px;
  border-radius: 3px;
  background: #d9cebd;
}
.progress-fill {
  position: absolute;
  left: 0;
  top: 3px;
  height: 4px;
  width: 0%;
  border-radius: 3px;
  background: var(--accent);
  transition: width .08s linear, background var(--fast);
}
.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--paper-3);
  border: 2px solid var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(40,32,24,.3);
  transition: transform .12s ease;
  pointer-events: none;
}
.progress:hover .progress-thumb { transform: translate(-50%, -50%) scale(1.2); }
.progress.is-dragging .progress-thumb { transform: translate(-50%, -50%) scale(1.25); }
body.is-playing .progress-fill, body.is-playing .progress-thumb { background: var(--accent); }
body.is-playing .progress-thumb { background: var(--paper-3); }

/* ============================================================
   МОДАЛЫ
   ============================================================ */

.modal {
  width: min(920px, calc(100vw - 32px));
  max-width: none;
  max-height: min(88vh, 880px);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.modal::backdrop {
  background: rgba(38, 32, 25, .56);
  backdrop-filter: blur(4px);
}
.modal-shell {
  position: relative;
  max-height: min(88vh, 880px);
  overflow-y: auto;
  padding: 36px 40px 34px;
  border: 1px solid #bcae9a;
  background:
    radial-gradient(90% 60% at 100% 0, rgba(255,255,255,.6), transparent 56%),
    var(--paper-2);
  box-shadow: 0 35px 80px -30px rgba(25,20,14,.75);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 15px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.modal-close:hover { border-color: var(--ink); color: var(--ink); background: var(--paper-3); }
.modal-eyebrow { color: var(--accent-dark); font-size: 8px; letter-spacing: .18em; }
.modal h2 {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-size: clamp(30px, 3.2vw, 42px);
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: -.04em;
}
.modal-lede { max-width: 660px; margin: 0 0 24px; color: var(--ink-soft); font-family: var(--serif); font-size: 14px; line-height: 1.58; }

.scenario-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.scenario { padding: 17px 18px 18px 0; border-right: 1px solid var(--line); }
.scenario + .scenario { padding-left: 18px; }
.scenario:last-child { border-right: 0; padding-right: 0; }
.scenario-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.scenario-number { font-family: var(--display); font-size: 23px; font-weight: 500; line-height: 1; color: var(--accent); letter-spacing: -.05em; }
.scenario-audience { max-width: 120px; color: var(--muted); font-size: 7.5px; line-height: 1.4; text-align: right; }
.scenario h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 18.5px; line-height: 1.15; font-weight: 500; letter-spacing: -.02em; }
.scenario p { margin: 0 0 9px; color: var(--ink-soft); font-size: 11.3px; line-height: 1.5; }
.scenario ol { margin: 0; padding-left: 16px; color: var(--ink-soft); font-size: 10.7px; line-height: 1.52; }
.scenario li { margin-bottom: 4px; padding-left: 2px; }
.scenario li::marker { color: var(--accent); font-family: var(--display); font-size: 8px; }

.help-lower { display: grid; grid-template-columns: .8fr 1.2fr; gap: 30px; margin-top: 22px; }
.shortcuts { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.shortcut-row { display: flex; align-items: center; gap: 9px; margin-top: 7px; color: var(--ink-soft); font-size: 10px; }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  background: var(--paper-3);
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 8px;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 1px 0 var(--line);
}
.help-tip { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.help-tip p { margin: 7px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }

.sources-modal { width: min(680px, calc(100vw - 32px)); }
.sources-list { list-style: none; padding: 0; margin: 8px 0 20px; border-top: 1px solid var(--line); }
.sources-list li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.source-index { font-family: var(--display); font-size: 9px; color: var(--muted-2); padding-top: 2px; font-variant-numeric: tabular-nums; }
.sources-list a { color: var(--ink); font-family: var(--serif); font-size: 15px; text-decoration: none; border-bottom: 1px solid var(--line-strong); transition: color var(--fast), border-color var(--fast); }
.sources-list a:hover { color: var(--accent-dark); border-color: var(--accent); }
.sources-list p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.source-note { padding: 12px 14px; border-left: 2px solid var(--accent); background: #f5e8e1; color: var(--ink-soft); font-size: 10.5px; line-height: 1.55; }
.source-note b { color: var(--ink); }
.portrait-note { margin: 13px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 30px;
  background: var(--paper);
  font-family: var(--serif);
  font-size: 20px;
  text-align: center;
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

@media (max-width: 1280px) {
  :root { --rail-w: 174px; }
  .topbar { padding-left: 18px; padding-right: 18px; }
  .topbar-primary { gap: 9px; }
  .search-wrap { max-width: 260px; }
  .timeline-caption { padding-left: 18px; padding-right: 18px; }
  .progress-wrap { padding-left: 18px; padding-right: 18px; }
  .help-text-button { display: none; }
  .timeline-hint { max-width: 370px; }
}

@media (max-width: 1100px) {
  :root { --sidebar-w: 364px; --rail-w: 160px; }
  .brand-title { font-size: 37px; }
  .topbar-secondary { gap: 3px; }
  .filter-pill { padding: 0 7px; font-size: 8.5px; }
  .slowdown-check span:last-child { display: none; }
  .search-kbd { display: none; }
  .legend { width: 265px; }
}

@media (max-width: 900px) {
  .topbar-secondary { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .topbar-secondary::-webkit-scrollbar { display: none; }
  .help-text-button { display: none; }
  .timeline-hint { display: none; }
  .year-block { min-width: 96px; padding-left: 10px; padding-right: 5px; }
  .year-value { font-size: 22px; }
  .search-wrap { flex-basis: 180px; }
  .play-button { min-width: 82px; padding-right: 10px; }
  .legend { width: 250px; }
}

@media (max-width: 980px) {
  :root { --rail-w: 104px; --sidebar-w: 100%; }

  body { overflow: hidden; }

  .app {
    display: block;
    height: calc(100vh - 54px);
    height: calc(100dvh - 54px);
  }

  .main { height: 100%; }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    width: 100%;
    height: 90dvh;
    max-height: 90vh;
    border-right: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -20px 60px -20px rgba(32,25,18,.5);
    transform: translateY(calc(100% - 54px));
    transition: transform .32s cubic-bezier(.2,.8,.2,1);
    will-change: transform;
  }
  body.sheet-open .sidebar { transform: translateY(0); }
  .sidebar-scroll { padding: 6px 18px 24px; }

  .sheet-handle {
    position: relative;
    z-index: 3;
    display: flex;
    flex: 0 0 54px;
    align-items: center;
    gap: 8px;
    height: 54px;
    padding: 4px 18px 0;
    border-radius: 16px 16px 0 0;
    background: var(--paper-2);
    cursor: grab;
    touch-action: none;
    user-select: none;
  }
  .sheet-handle:active { cursor: grabbing; }
  .sheet-grab {
    position: absolute;
    top: 7px;
    left: 50%;
    width: 34px;
    height: 4px;
    border-radius: 4px;
    background: #c8bcaa;
    transform: translateX(-50%);
  }
  .sheet-handle-title { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--ink); }
  .sheet-handle-title b { color: var(--accent-dark); font-family: var(--display); font-size: 9px; }
  .sheet-handle-hint { color: var(--muted-2); font-size: 8px; }
  .sheet-chevron { width: 16px; height: 16px; margin-left: auto; color: var(--muted); transition: transform .25s ease; }
  body.sheet-open .sheet-chevron { transform: rotate(180deg); }
  .sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(35,29,22,.28);
    backdrop-filter: blur(1.5px);
  }
  .sheet-backdrop[hidden] { display: none; }

  .brand-block { padding-top: 10px; }
  .brand-title { font-size: 34px; margin-bottom: 10px; }
  .brand-title em { padding-left: 16px; }
  .manifesto { font-size: 12.5px; margin-bottom: 10px; }
  .brand-meta { padding-bottom: 12px; }
  .panel-heading { padding-top: 14px; }

  .topbar { padding: 8px 12px 6px; }
  .topbar-primary { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 7px; min-height: 0; }
  .search-wrap { grid-column: 1 / 3; max-width: none; height: 36px; flex-basis: auto; }
  .sheet-toggle {
    display: inline-flex;
    grid-column: 3;
    grid-row: 1;
    align-items: center;
    gap: 5px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--line-strong);
    background: var(--paper-3);
    color: var(--ink-soft);
    font-size: 9px;
    font-weight: 600;
  }
  .sheet-toggle b { font-family: var(--display); font-size: 8px; color: var(--accent-dark); }
  .sheet-toggle-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
  .year-block { grid-column: 1; grid-row: 2; min-width: 74px; padding-left: 0; border-left: 0; }
  .year-value { font-size: 21px; }
  .year-caption { font-size: 6.5px; }
  .year-suffix { font-size: 7.5px; }
  .play-group { grid-column: 2 / 4; grid-row: 2; margin-left: 0; gap: 4px; justify-content: flex-end; }
  .play-button { height: 32px; min-width: 76px; padding: 0 9px 0 7px; font-size: 9px; }
  .play-icon { width: 18px; height: 18px; }
  .icon-button { width: 27px; height: 27px; }
  .speed-switch { height: 28px; }
  .speed-switch button { height: 22px; min-width: 28px; font-size: 8px; }
  .filter-fade {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: absolute;
    right: 0;
    bottom: 2px;
    width: 38px;
    height: 33px;
    padding-right: 8px;
    z-index: 2;
    background: linear-gradient(90deg, rgba(246,241,232,0), rgba(246,241,232,.97) 62%);
    color: var(--muted);
    font-family: var(--display);
    font-size: 17px;
    pointer-events: none;
  }
  .mobile-hint { display: inline; }
  .timeline-hint { display: none; }
  .play-status { display: none !important; }
  .topbar-secondary {
    margin-top: 7px;
    padding-top: 6px;
    gap: 4px;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
  }
  .filter-pill { height: 26px; font-size: 8px; gap: 4px; padding: 0 6px; }
  .pill-count { display: none; }
  .slowdown-check { display: inline-flex; }
  .slowdown-check span:last-child { display: inline; font-size: 7.5px; }
  .text-button { font-size: 8px; padding: 0 5px; }
  .filter-pill.toggle-pill { font-size: 7.5px; }

  .popover { position: fixed; left: 12px; right: 12px; top: auto; bottom: 64px; width: auto; max-height: 65vh; overflow-y: auto; z-index: 120; }

  .timeline-caption { padding: 5px 12px 4px; min-height: 27px; }
  .timeline-kicker { font-size: 7px; }
  .play-status { font-size: 7px; margin-right: 104px; }

  .timeline-scroll { scrollbar-width: none; }
  .timeline-scroll::-webkit-scrollbar { display: none; }
  .author-rail { background: #f4efe5; }
  .rail-author { padding-left: 8px; padding-right: 5px; gap: 4px; }
  .rail-author .rail-years { display: none; }
  .rail-author .rail-name { font-size: var(--rail-font, 9px); }
  .author-rail.is-compact .rail-years { display: none; }
.rail-author .rail-tragic { width: 9px; height: 9px; flex-basis: 9px; font-size: 6px; }
  .rail-author .rail-dot { width: 4px; height: 4px; flex-basis: 4px; }

  .legend { left: 0; bottom: 0; width: 224px; }
  .legend.is-collapsed { width: 148px; }
  .legend-body { max-height: 40vh; }
  .legend-grid { gap: 3px 8px; }
  .legend-item { font-size: 7.8px; }
  .zoom-controls { right: 9px; top: 2px; }
  .zoom-button, .zoom-fit { width: 24px; }
  .zoom-level { min-width: 25px; }
  .event-card { width: min(290px, calc(100vw - 24px)); }
  .chart-tooltip { max-width: 230px; }
  .slow-toast { top: 34px; }

  .progress-wrap { flex-basis: 42px; padding: 6px 12px 7px; }
  .progress-meta { margin-bottom: 3px; }
  .progress-note { font-size: 6.5px; }

  .scenario-grid { grid-template-columns: 1fr; }
  .scenario, .scenario + .scenario { padding: 15px 0; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .scenario:last-child { border-bottom: 0; }
  .scenario-top { margin-bottom: 8px; }
  .scenario-audience { max-width: none; }
  .help-lower { grid-template-columns: 1fr; gap: 18px; }
  .modal-shell { padding: 28px 20px 24px; }
  .modal { max-height: 92vh; width: calc(100vw - 18px); }
  .modal-shell { max-height: 92vh; }
  .modal h2 { font-size: 30px; }
  .modal-lede { font-size: 13px; }
  .sources-list li { grid-template-columns: 36px minmax(0,1fr); }
}

@media (max-width: 420px) {
  .play-label { display: none; }
  .play-button { min-width: 38px; width: 38px; padding: 0; justify-content: center; }
  .search-wrap { grid-column: 1 / 3; }
  .topbar-primary { grid-template-columns: minmax(0, 1fr) auto auto; }
  .progress-note { display: none; }
  .brand-title { font-size: 32px; }
  .modal-shell { padding-left: 16px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   КАРТОЧКИ ПРОИЗВЕДЕНИЯ И СВЯЗИ
   ============================================================ */

.work-row {
  width: 100%;
  border: 0;
  border-bottom: 1px dotted transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color var(--fast), background var(--fast), border-color var(--fast), padding var(--fast);
}
.work-row:hover {
  color: var(--ink);
  background: rgba(191, 138, 63, .08);
  border-bottom-color: var(--line-strong);
  padding-left: 4px;
  padding-right: 4px;
}
.work-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.work-row .work-arrow {
  color: var(--accent);
  opacity: 0;
  margin-left: 4px;
  font-size: 10px;
  transition: opacity var(--fast);
}
.work-row:hover .work-arrow { opacity: 1; }

.work-modal { width: min(900px, calc(100vw - 32px)); }
.relation-modal { width: min(800px, calc(100vw - 32px)); }
.work-modal .modal-shell, .relation-modal .modal-shell { padding: 40px 44px 36px; }

.work-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 32px;
}
.work-poster {
  position: relative;
  padding-right: 24px;
  border-right: 1px solid var(--line);
}
.work-kicker {
  display: block;
  color: var(--accent-dark);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.work-dialog-year {
  font-family: var(--display);
  font-size: 54px;
  line-height: .9;
  font-weight: 500;
  letter-spacing: -.07em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}
.work-dialog-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -.045em;
}
.work-kind {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.work-author-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.work-author-card img {
  width: 42px;
  height: 52px;
  object-fit: cover;
  object-position: center 20%;
  border: 1px solid var(--line-strong);
  filter: saturate(.8) sepia(.06);
}
.work-author-caption { color: var(--muted); font-size: 8px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 3px; }
.work-author-link {
  display: inline;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.2;
  text-align: left;
  transition: color var(--fast), border-color var(--fast);
}
.work-author-link:hover { color: var(--accent-dark); border-color: var(--accent); }
.work-author-card .movement-badge { margin-top: 5px; display: flex; width: fit-content; }

.work-content { min-width: 0; }
.work-annotation {
  margin: 4px 0 20px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.48;
  letter-spacing: -.01em;
  color: var(--ink-2);
}
.work-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10px;
}
.work-meta-line b { color: var(--ink-soft); font-weight: 700; }
.work-section { margin-top: 18px; }
.work-events, .work-other-list { display: flex; flex-wrap: wrap; gap: 6px; }
.work-event-chip, .work-other-chip {
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.3;
  text-align: left;
  transition: border-color var(--fast), background var(--fast), color var(--fast);
}
.work-event-chip:hover, .work-other-chip:hover { border-color: var(--accent); background: #f5e8e1; color: var(--accent-dark); }
.work-event-chip span, .work-other-chip span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 7.8px;
  font-variant-numeric: tabular-nums;
}
.work-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; }
.work-timeline-button {
  padding: 8px 11px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-3);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  transition: background var(--fast), border-color var(--fast);
}
.work-timeline-button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.work-wiki-link {
  color: var(--muted);
  font-size: 9px;
  text-decoration: none;
  border-bottom: 1px dotted var(--line-strong);
}
.work-wiki-link:hover { color: var(--accent-dark); border-color: var(--accent); }

.relation-hero {
  display: flex;
  gap: 17px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.relation-big-icon {
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  border: 1px solid var(--rel-color, var(--accent));
  border-radius: 50%;
  color: var(--rel-color, var(--accent));
  background: var(--paper-3);
}
.relation-big-icon svg { width: 28px; height: 28px; }
.relation-hero .modal-eyebrow { margin-bottom: 5px; }
.relation-hero h2 { margin: 0 0 3px; font-size: 37px; }
.relation-label {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
}
.relation-note {
  margin: 18px 0;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-2);
}
.relation-type-desc {
  margin: -8px 0 20px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}
.relation-authors {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.relation-author {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.relation-author img {
  flex: 0 0 54px;
  width: 54px;
  height: 68px;
  object-fit: cover;
  object-position: center 20%;
  border: 1px solid var(--line-strong);
  filter: saturate(.8) sepia(.06);
}
.relation-author-name {
  display: block;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.18;
  text-align: left;
  transition: color var(--fast), border-color var(--fast);
}
.relation-author-name:hover { color: var(--accent-dark); border-color: var(--accent); }
.relation-author small { display: block; margin-top: 4px; color: var(--muted); font-size: 8.5px; }
.relation-bridge {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--rel-color);
  background: var(--paper-3);
  font-size: 14px;
}
.relation-bridge svg { width: 15px; height: 15px; }
.relation-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.relation-year-button {
  padding: 8px 11px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-3);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  transition: background var(--fast), border-color var(--fast);
}
.relation-year-button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

/* ============================================================
   PLAY MOMENT
   ============================================================ */

.play-moment {
  position: absolute;
  z-index: 58;
  width: 310px;
  padding: 12px 13px 10px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  background: rgba(251, 248, 241, .98);
  box-shadow: 0 22px 45px -22px rgba(40, 32, 24, .65);
  opacity: 0;
  transform: translateY(8px) scale(.98);
  transform-origin: left bottom;
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: auto;
}
.play-moment.is-visible { opacity: 1; transform: none; }
.play-moment.is-leaving { opacity: 0; transform: translateY(-5px) scale(.985); }
.play-moment[hidden] { display: none; }
.play-moment-close {
  position: absolute;
  top: 4px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
.play-moment-close:hover { color: var(--ink); }
.pm-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-dark);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.pm-kicker::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.pm-main { display: flex; gap: 10px; padding-right: 13px; }
.pm-portrait {
  flex: 0 0 42px;
  width: 42px;
  height: 54px;
  object-fit: cover;
  object-position: center 18%;
  border: 1px solid var(--line-strong);
  filter: saturate(.78) sepia(.08);
}
.pm-title {
  margin: 0 0 3px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.12;
  font-weight: 500;
  letter-spacing: -.025em;
}
.pm-author { color: var(--muted); font-size: 8.5px; line-height: 1.3; }
.pm-author b { color: var(--ink-soft); font-weight: 700; }
.pm-note { margin: 9px 0 8px; color: var(--ink-soft); font-size: 10.5px; line-height: 1.45; }
.pm-more {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .04em;
}
.pm-more:hover { text-decoration: underline; text-underline-offset: 2px; }
.pm-timer {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  background: var(--paper-deep);
  overflow: hidden;
}
.pm-timer::after {
  content: '';
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: pmTimer linear forwards;
}
@keyframes pmTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* relation icons */
.rel-icon svg, .legend-rel-icon svg, .relation-bridge svg, .relation-big-icon svg { display: block; }
.rel-icon svg { width: 10px; height: 10px; }
.legend-rel-icon svg { width: 10px; height: 10px; }
.relation-icon-svg { pointer-events: none; }
.relation-group:focus { outline: none; }
.relation-group:focus .relation-icon-disc { stroke-width: 2.4; }

/* layout adjustments for the larger cast */
.timeline-svg.is-dense .work-dot { stroke-width: 1.5; }

@media (max-width: 760px) {
  .work-layout { grid-template-columns: 1fr; gap: 16px; }
  .work-poster { padding-right: 0; border-right: 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
  .work-dialog-year { font-size: 44px; margin-bottom: 9px; }
  .work-modal .work-dialog-title { font-size: 27px; }
  .work-annotation { font-size: 16px; margin-top: 0; }
  .work-modal .modal-shell, .relation-modal .modal-shell { padding-left: 20px; padding-right: 20px; }
  .relation-authors { grid-template-columns: 1fr; gap: 10px; }
  .relation-bridge { transform: rotate(90deg); margin: 0 auto; }
  .relation-hero h2 { font-size: 31px; }
  .relation-big-icon { flex-basis: 48px; width: 48px; height: 48px; }
  .relation-big-icon svg { width: 24px; height: 24px; }
  .play-moment { width: min(280px, calc(100vw - 24px)); }
}
.pm-extra {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 6px;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 8px;
  line-height: 1.3;
}
.relation-glyph { display: inline-flex; align-items: center; }
.relation-glyph svg { width: 9px; height: 9px; }
.check-icon svg { width: 10px; height: 10px; }
.relation-icon-text { display: none; }
.relation-icon-group { cursor: pointer; }
.relation-icon-group:hover .relation-icon-disc { stroke-width: 1.8; }
.relation-icon-group:focus { outline: none; }
.relation-icon-group:focus .relation-icon-disc { stroke-width: 2.6; }
.focus-relation .rel-icon[data-relation-open] { cursor: pointer; }
.focus-relation .rel-icon[data-relation-open]:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.focus-relation button.rel-icon { padding: 0; cursor: pointer; }
.play-moment { cursor: pointer; }
.play-moment-close { cursor: pointer; }

/* Защита от переполнения длинных названий */
.card-name,
.focus-name,
.work-dialog-title,
.work-kind,
.work-author-link,
.work-annotation,
.work-meta-line span,
.work-event-chip,
.work-other-chip,
.pm-title,
.pm-author,
.event-card h3,
.relation-author-name,
.relation-label {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

.work-poster,
.work-author-card > div,
.relation-author > div {
  min-width: 0;
}

.work-modal .work-dialog-title {
  max-width: 100%;
  font-size: clamp(24px, 2.8vw, 30px);
}

.work-layout {
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
}

.work-author-card .movement-badge,
.work-meta-line b,
.work-author-link { max-width: 100%; }

.work-event-chip,
.work-other-chip {
  max-width: 100%;
  white-space: normal;
}

.pm-main > div,
.pm-author,
.pm-title { min-width: 0; }

.relation-author-name { max-width: 100%; }

@media (max-width: 980px) {
  .work-layout { grid-template-columns: 1fr; gap: 16px; }
  .work-poster { padding-right: 0; border-right: 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
  .work-dialog-year { font-size: 44px; margin-bottom: 9px; }
  .work-modal .work-dialog-title { font-size: 27px; }
  .work-annotation { font-size: 16px; margin-top: 0; }
  .work-modal .modal-shell, .relation-modal .modal-shell { padding-left: 20px; padding-right: 20px; }
  .relation-authors { grid-template-columns: 1fr; gap: 10px; }
  .relation-bridge { transform: rotate(90deg); margin: 0 auto; }
  .relation-hero h2 { font-size: 31px; }
  .relation-big-icon { flex-basis: 48px; width: 48px; height: 48px; }
  .relation-big-icon svg { width: 24px; height: 24px; }
  .play-moment { width: min(280px, calc(100vw - 24px)); }
}
.movement-badge { flex-wrap: wrap; white-space: normal; max-width: 100%; row-gap: 4px; }
.movement-name { white-space: nowrap; }
.tragic-badge { white-space: normal; }

@media (max-width: 980px) { .timeline-range { display: none; } }
.event-label { transition: opacity .12s ease; }
.event-label.is-scrolled-away { opacity: 0; visibility: hidden; pointer-events: none; }
