/* ==========================================================================
   Путь Бессмертного — стили
   Образ: страница классической книги. Рисовая бумага, тушь, киноварь печати.
   Правила: тонкие линии вместо карточек, без теней, свечений и градиентов;
   киноварь — единственный акцент (главные действия, «готово к покупке»).
   ========================================================================== */

:root {
  /* Единственная тема — «тушечница»: тёмная бумага, светлая тушь, киноварь печати. */
  --paper: #17150f;
  --paper-2: #211e17;
  --ink: #e9e1cf;
  --ink-2: #b3a991;
  --ink-3: #7c735f;
  --rule: #3a3428;
  --rule-strong: #564d3c;
  --cinnabar: #cf4a3c;
  --cinnabar-2: #e0604f;
  --on-cinnabar: #fbf3e6;
  --jade: #7fb39e;
  --indigo: #9aa6d4;

  --font: 'Literata', 'PT Serif', Georgia, serif;
  --font-glyph: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-brush: 'Ma Shan Zheng', 'Noto Serif SC', 'Kaiti SC', serif;
  --radius: 2px;
  --gutter: 16px;

  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Атрибут hidden должен побеждать любые display: flex/grid в компонентах. */
[hidden] { display: none !important; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::selection { background: var(--cinnabar); color: var(--on-cinnabar); }

.glyph { font-family: var(--font-glyph); font-weight: 500; line-height: 1; }
.brush { font-family: var(--font-brush); font-weight: 400; line-height: 1; }

button { font: inherit; color: inherit; }

h2, h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
h3 {
  display: flex; align-items: center; gap: 12px;
  margin: 26px 0 12px;
}
h3::after { content: ''; flex: 1; border-top: 1px solid var(--rule); }

.hint { color: var(--ink-2); font-size: 13px; margin: 4px 0 10px; }
.hint.warn { color: var(--cinnabar); }
.hint.warn:empty { display: none; }

code { font-size: 0.9em; padding: 0 4px; border-bottom: 1px solid var(--rule); }

/* ----------------------------- загрузка ----------------------------- */

.boot { height: 100vh; display: grid; place-content: center; text-align: center; color: var(--ink-2); }
.boot-glyph { font-size: 72px; color: var(--ink); margin-bottom: 12px; }

/* ----------------------------- каркас ----------------------------- */

#app { height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-glyph {
  font-size: 22px; color: var(--on-cinnabar); background: var(--cinnabar);
  padding: 4px 6px 2px; border-radius: var(--radius);
}
.brand-name { font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); }

.header-chips { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: flex-end; font-size: 14px; }
.header-chip { color: var(--ink-2); font-variant-numeric: tabular-nums; cursor: help; }
.header-chip b { font-weight: 500; }
.header-chip.jade { color: var(--jade); }
.header-chip.violet { color: var(--indigo); }
.save-indicator { font-size: 12px; color: var(--ink-3); opacity: 0; }

.layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(0, 1fr) minmax(310px, 380px);
}

.panel {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}
.panel + .panel { border-left: 1px solid var(--rule); }

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 18px 18px 10px;
}

/* ----------------------------- кнопки ----------------------------- */

.btn {
  appearance: none; cursor: pointer;
  padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  transition: background 0.12s, color 0.12s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled,
.btn:disabled:hover, .btn.is-disabled:hover {
  cursor: not-allowed; color: var(--ink-3); border-color: var(--rule-strong); border-style: dashed; background: transparent;
}
.btn:focus-visible, .gen-row:focus-visible, .upgrade:focus-visible, .tab-btn:focus-visible,
.law:focus-visible, .dantian:focus-visible, .seg-btn:focus-visible, .omen:focus-visible {
  outline: 2px solid var(--cinnabar); outline-offset: 2px;
}
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-wide { width: 100%; padding: 10px 14px; }

/* Покупки (btn-gold) — обычная тушь: красный означает только «не хватает» и готовый прорыв.
   Нефрит и индиго — оттенки контура для перерождения и трансценденции. */
.btn-jade:not(.is-disabled):not(:disabled) { border-color: var(--jade); color: var(--jade); }
.btn-jade:not(.is-disabled):not(:disabled):hover { background: var(--jade); color: var(--paper); }
.btn-violet:not(.is-disabled):not(:disabled) { border-color: var(--indigo); color: var(--indigo); }
.btn-violet:not(.is-disabled):not(:disabled):hover { background: var(--indigo); color: var(--paper); }
.btn-crimson { border-color: var(--cinnabar); color: var(--cinnabar); }
.btn-crimson:hover { background: var(--cinnabar); color: var(--on-cinnabar); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

.seg { display: inline-flex; gap: 2px; }
.seg-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 2px 7px; font-size: 13px; color: var(--ink-3);
  border-bottom: 1px solid transparent;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { color: var(--ink); border-bottom-color: var(--ink); }

/* ----------------------------- культивация (левая колонна) ----------------------------- */

.panel-cultivation { padding: 22px 20px; display: flex; flex-direction: column; gap: 20px; }

.resource { text-align: center; }
.qi-amount {
  font-size: 40px; font-weight: 500; line-height: 1.1; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.qi-rate { font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.qi-click { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.qi-rate.buffed, .qi-click.buffed { color: var(--cinnabar); }

.dantian-wrap { position: relative; display: grid; place-items: center; padding: 18px 0 6px; }
.dantian {
  position: relative; z-index: 1; width: min(240px, 66vw); aspect-ratio: 1;
  border: 0; padding: 0; background: transparent; cursor: pointer; color: var(--ink);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
  border-radius: 50%;
}
/* Покой: круг медленно вращается (SMIL в svg), иероглиф дышит (вдох 4 с, выдох 4 с). */
.dantian-art { position: absolute; inset: -16%; width: 132%; height: 132%; overflow: visible; pointer-events: none; }
.dt-paper { fill: var(--paper); }
.dt-enso-stroke { stroke-width: 3.6; }
.dt-layer { opacity: 0; transition: opacity 0.8s ease; transform-box: fill-box; transform-origin: center; }
.dt-layer.on { opacity: 1; }
.dt-layer.reveal { animation: dt-reveal 1.6s cubic-bezier(.2,.7,.2,1); }
.dt-core { transform-box: fill-box; transform-origin: center; animation: breathe-core 8s ease-in-out infinite; }
.dt-void { opacity: 0.4; animation: dt-void 10s ease-in-out infinite; }
.dt-bolt { opacity: 0.25; animation: dt-bolt 5.1s steps(1, end) infinite; }
.dt-seal rect { fill: var(--cinnabar); stroke: none; }
.dt-seal text { fill: var(--on-cinnabar); stroke: none; font-family: var(--font-brush); font-size: 12px; }
.dantian.evolve .dantian-glyph { animation: dt-glyph-evolve 1.6s ease-out, breathe 8s ease-in-out infinite 1.6s; }
.dantian-wrap { container-type: inline-size; }
.dantian-wrap.wide { padding-top: 34px; }
/* Внешние слои рисунка выходят за кнопку на 16% — кнопка ужимается, чтобы рисунок влезал в колонку. */
.dantian-wrap.wide .dantian { max-width: 74cqi; }
.dantian-wrap.wide .dantian-form { margin-top: 30px; }
.dantian-form {
  margin-top: 4px; font-size: 12px; letter-spacing: 0.08em; color: var(--ink-3); text-align: center; cursor: help;
}
@keyframes dt-reveal { 0% { opacity: 0; transform: scale(1.4); } 60% { opacity: 1; } 100% { opacity: 1; transform: scale(1); } }
@keyframes dt-void { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.55; } }
@keyframes dt-bolt { 0%, 86% { opacity: 0.25; } 88% { opacity: 1; } 90% { opacity: 0.35; } 92% { opacity: 0.9; } }
@keyframes dt-glyph-evolve { 0% { transform: scale(1); } 25% { transform: scale(1.18); } 100% { transform: scale(1); } }
.dantian-glyph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 112px; padding-top: 6%; pointer-events: none;
  animation: breathe 8s ease-in-out infinite;
}
.dantian::before {
  content: ''; position: absolute; inset: 22%; border-radius: 50%;
  background: var(--ink); opacity: 0.05; animation: breathe-core 8s ease-in-out infinite;
}
.dantian:hover::before { opacity: 0.09; }
.dantian.pulse .dantian-glyph { animation: press 0.16s ease-out, breathe 8s ease-in-out infinite 0.16s; }
/* Подсказка новичку: красным — только основной круг, а не весь рисунок облика. */
.dantian.beckon .dt-enso { stroke: var(--cinnabar); }
.dantian.beckon::after {
  content: ''; position: absolute; inset: -6%; border-radius: 50%; border: 1px solid var(--cinnabar);
  animation: beckon 2.4s ease-out infinite;
}
.dantian-hint { font-size: 13px; color: var(--cinnabar); margin-top: 10px; text-align: center; animation: fade-in 0.6s ease; }
.qi-flow {
  position: absolute; left: 50%; top: calc(50% + 6px); width: 150%; aspect-ratio: 1; max-width: 360px;
  transform: translate(-50%, -50%); pointer-events: none; z-index: 0;
}
@keyframes enso-turn { from { transform: rotate(-18deg); } to { transform: rotate(342deg); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@keyframes breathe-core { 0%, 100% { transform: scale(0.92); } 50% { transform: scale(1.06); } }
@keyframes beckon { from { transform: scale(0.96); opacity: 0.8; } to { transform: scale(1.18); opacity: 0; } }
.dantian-ripple {
  position: absolute; inset: 12%; border-radius: 50%; border: 1px solid var(--ink-2);
  pointer-events: none; animation: ripple 0.7s ease-out forwards;
}
@keyframes press { 0% { transform: scale(0.95); } 100% { transform: scale(1); } }
@keyframes ripple { from { transform: scale(0.9); opacity: 0.7; } to { transform: scale(1.35); opacity: 0; } }

.realm-card { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--ink); }
.realm-head { display: flex; gap: 14px; align-items: center; }
.realm-glyph {
  width: 48px; height: 48px; flex: none; display: grid; place-items: center; font-size: 28px;
  border: 1px solid var(--ink); border-radius: var(--radius);
}
.realm-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-3); }
.realm-name { font-weight: 500; line-height: 1.3; }
.realm-mult { font-size: 13px; color: var(--ink-2); }

.progress { position: relative; height: 18px; border-bottom: 1px solid var(--rule-strong); }
.progress-fill { position: absolute; left: 0; bottom: -1px; height: 3px; width: 0; background: var(--ink); transition: width 0.2s linear; }
.progress-text { position: absolute; inset: 0 0 4px; display: flex; align-items: flex-end; justify-content: flex-end; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress.small { height: 16px; }
.progress.small .progress-text { font-size: 11px; justify-content: flex-start; }
.progress-fill.jade { background: var(--jade); }
.mystery .progress-fill { background: var(--indigo); }

.btn-break { width: 100%; padding: 10px 12px; }
/* Готовый прорыв: заливка киноварью. Селектор сильнее .btn-gold, иначе текст сливается с фоном. */
.btn.btn-break.ready:not(.is-disabled) { background: var(--cinnabar); color: var(--on-cinnabar); border: 1px solid var(--cinnabar); }
.btn.btn-break.ready:not(.is-disabled):hover { background: var(--cinnabar-2); border-color: var(--cinnabar-2); color: var(--on-cinnabar); }

.realm-req { font-size: 13px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.realm-req:empty { display: none; }
.req-label { color: var(--ink-3); }
.req-item { color: var(--ink); }
.req-item.ok { color: var(--jade); }
.req-miss { flex-basis: 100%; font-size: 12px; color: var(--ink-3); }
.realm-card .btn-small { align-self: flex-start; }

.buffs { display: flex; flex-direction: column; gap: 10px; }
.buffs:empty { display: none; }
.buff { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; animation: fade-in 0.3s ease; }
.buff-glyph {
  width: 30px; height: 30px; display: grid; place-items: center; font-size: 16px;
  background: var(--cinnabar); color: var(--on-cinnabar); border-radius: var(--radius);
}
.buff-name { font-size: 13px; }
.buff-bar { height: 2px; background: var(--rule); margin-top: 5px; }
.buff-fill { height: 100%; background: var(--cinnabar); }
.buff-time { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.bag { display: flex; flex-direction: column; gap: 5px; padding-top: 14px; border-top: 1px solid var(--rule); }
.bag-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-3); margin-bottom: 4px; }
.mat { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; font-size: 13px; }
.mat-glyph { font-size: 14px; text-align: center; color: var(--ink-2); }
.mat-name { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-amount { font-variant-numeric: tabular-nums; }
.mat-rate { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12px; min-width: 52px; text-align: right; }

/* ----------------------------- вкладки (центр) ----------------------------- */

.panel-tabs { display: grid; grid-template-columns: 98px minmax(0, 1fr); overflow: hidden; }
/* Вертикальная полоса вкладок: печать-иероглиф и подпись под ней. */
.tabs {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-right: 1px solid var(--rule); overflow-y: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs-main, .tabs-utility { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.tabs-utility { padding-top: 10px; border-top: 1px solid var(--rule); margin: 0 8px; }
/* Служебные вкладки — строкой иконок без подписей (подпись в title). */
@media (min-width: 961px) {
  .tabs-utility { flex-direction: row; justify-content: space-between; margin: 0 7px; }
  .tabs-utility .tab-btn { border-left: 0; padding: 1px; flex: none; }
  .tabs-utility .tab-icon .tab-seal { width: 24px; height: 24px; font-size: 14px; }
  .tabs-utility .tab-icon { padding: 1px; }
  .tabs-utility .tab-label { display: none; }
  .tabs-utility .tab-btn.active .tab-seal { outline: 1px solid var(--ink); outline-offset: 2px; }
  .tabs-utility .tab-btn.fresh::after { top: 0; right: 0; }
}
.tab-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 4px;
  color: var(--ink-3); font-size: 11px; line-height: 1.15; text-align: center;
  border-left: 2px solid transparent;
}
.tab-seal {
  width: 32px; height: 32px; display: grid; place-items: center; font-size: 20px; padding-top: 2px;
  border: 1px solid currentColor; border-radius: var(--radius);
}
.tab-label { max-width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); border-left-color: var(--ink); }
.tab-btn.active .tab-seal { background: var(--ink); color: var(--paper); border-color: var(--ink); }
@media (min-width: 961px) {
  .tab-icon { padding: 4px; }
  .tab-icon .tab-seal { width: 28px; height: 28px; font-size: 17px; }
}
.tab-btn.fresh::after {
  content: ''; position: absolute; top: 5px; right: 12px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cinnabar);
}
.tab-body { --tab-pad: 26px; flex: 1; overflow-y: auto; padding: 6px 26px 32px; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
.tab-intro { color: var(--ink-2); font-size: 14px; margin: 18px 0 8px; max-width: 68ch; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; }

/* Путь */
.ladder { display: flex; flex-direction: column; }
.ladder-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 16px; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--rule); color: var(--ink-3); }
.ladder-row.done, .ladder-row.next { color: var(--ink); }
.ladder-row.next .ladder-name { font-weight: 500; }
.ladder-row.next .ladder-status { color: var(--cinnabar); }
.ladder-glyph { font-size: 18px; text-align: center; }
.ladder-name { font-size: 14px; }
.ladder-meta { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ladder-status { text-align: right; }

.mult-table, .stats-table { display: flex; flex-direction: column; }
.mult-row, .stat-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; border-bottom: 1px solid var(--rule); }
.mult-row:last-child { border-bottom: 0; border-top: 1px solid var(--ink); margin-top: -1px; font-weight: 500; }
.mult-value, .stat-value { font-variant-numeric: tabular-nums; text-align: right; }

/* Сетки: меридианы, перки, пилюли, павильоны, артефакты, мистерии — как разлинованная таблица. */
/* Флекс-перенос вместо grid auto-fill: карточки последнего ряда растягиваются — без пустых клеток. */
.meridian-grid, .perk-grid, .card-grid {
  display: flex; flex-wrap: wrap;
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule);
}
.meridian-grid > *, .perk-grid > *, .card-grid > * { flex: 1 1 230px; min-width: 0; }
.meridian-card, .perk, .card {
  padding: 14px; display: flex; flex-direction: column; gap: 9px;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.meridian-card.locked, .card.locked, .card.dim { color: var(--ink-3); }
.meridian-card.locked .meridian-glyph, .card.locked .card-glyph, .card.dim .card-glyph { color: var(--ink-3); border-color: var(--rule); }
.card.highlight { box-shadow: inset 3px 0 0 var(--cinnabar); }
.card.focused { background: color-mix(in srgb, var(--indigo) 7%, transparent); box-shadow: inset 0 2px 0 var(--indigo); }
.hero + .card-grid { margin-top: 18px; }
.card .btn, .meridian-card .btn, .perk .btn { margin-top: auto; align-self: flex-start; }

.meridian-head, .perk-head, .card-head { display: flex; gap: 12px; align-items: center; }
.meridian-glyph, .perk-glyph, .card-glyph {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; font-size: 18px;
  border: 1px solid var(--ink); border-radius: var(--radius);
}
.card-glyph.big { font-family: var(--font-brush); font-size: 24px; }
.meridian-name, .perk-name, .card-name { font-weight: 500; font-size: 14px; line-height: 1.3; }
.meridian-sub, .perk-level, .card-sub, .card-meta { font-size: 12px; color: var(--ink-2); }
.perk-flavor { font-size: 12px; color: var(--ink-2); font-style: italic; flex: 1; }
.meridian-lock { font-size: 12px; color: var(--ink-3); }
.meridian-lock:empty { display: none; }

.acupoints { display: flex; justify-content: space-between; position: relative; padding: 4px 2px; }
.acupoints::before { content: ''; position: absolute; left: 6px; right: 6px; top: 50%; border-top: 1px solid var(--rule-strong); }
.acupoint { position: relative; width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--ink-3); background: var(--paper); transition: background 0.2s; }
.acupoint.open { background: var(--ink); border-color: var(--ink); }
.meridian-card.complete .acupoint.open { background: var(--cinnabar); border-color: var(--cinnabar); }

/* «Что даёт»: текущее → следующее */
.card-fx:empty { display: none; }
.fx { list-style: none; margin: 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.fx li { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.fx li span { color: var(--ink-3); }
.fx li b { color: var(--ink); font-weight: 500; }
.fx li.fx-new::before { content: '+ '; color: var(--jade); }
.law-fx { font-size: 12px; color: var(--ink-2); line-height: 1.35; margin: 2px 0; }
.law[data-status='locked'] .law-fx { color: var(--ink-3); }

.pips { display: flex; gap: 3px; }
.pip { flex: 1; height: 3px; background: var(--rule); }
.pip.on { background: var(--ink); }

/* Престиж */
.prestige-box {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: center;
  margin-top: 8px; padding: 18px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.prestige-main { display: flex; flex-direction: column; gap: 6px; }
.prestige-stats { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.prestige-stats span { color: var(--ink); font-variant-numeric: tabular-nums; }
.big-number { font-size: 34px; font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big-number.jade { color: var(--jade); }
.big-number.violet { color: var(--indigo); }

.law-tree { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; }
.law-branch { display: flex; flex-direction: column; position: relative; }
.law-branch-head { display: flex; gap: 10px; align-items: center; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--ink); }
.law-branch-seal { width: 28px; height: 28px; flex: none; display: grid; place-items: center; font-size: 18px; border: 1px solid var(--ink); border-radius: var(--radius); padding-top: 2px; }
.law-branch-name { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Цепочка законов: узлы на вертикальной линии. Подробно описан только следующий доступный. */
.law {
  appearance: none; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start;
  text-align: left; padding: 6px 0; background: transparent; border: 0; position: relative; cursor: default;
}
.law::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; border-left: 1px solid var(--rule-strong); }
.law:first-of-type::before { top: 14px; }
.law:last-child::before { bottom: calc(100% - 14px); }
.law-node { position: relative; z-index: 1; width: 11px; height: 11px; margin: 5px 0 0 3px; border-radius: 50%; border: 1px solid var(--ink-3); background: var(--paper); }
.law-name { font-size: 13px; line-height: 1.35; }
.law-fx, .law-cost { display: none; }
.law-cost { font-size: 12px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.law-fx { font-size: 12px; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }

.law[data-status='owned'] .law-node { background: var(--ink); border-color: var(--ink); }
.law[data-status='owned'] .law-name { color: var(--ink-2); }
.law[data-status='owned'] .law-name::after { content: ' ✓'; color: var(--jade); }

.law[data-status='affordable'], .law[data-status='available'] { padding: 10px 0; }
.law[data-status='affordable'] .law-node, .law[data-status='available'] .law-node { width: 17px; height: 17px; margin: 1px 0 0 0; border: 2px solid var(--ink); }
.law[data-status='affordable'] .law-name, .law[data-status='available'] .law-name { font-weight: 500; font-size: 14px; color: var(--ink); }
.law[data-status='affordable'] .law-fx, .law[data-status='available'] .law-fx,
.law[data-status='affordable'] .law-cost, .law[data-status='available'] .law-cost { display: block; }
.law[data-status='available'] .law-cost { color: var(--ink-3); }
.law[data-status='affordable'] { cursor: pointer; }
.law[data-status='affordable'] .law-cost { display: inline-block; border: 1px solid var(--ink); padding: 2px 8px; border-radius: var(--radius); color: var(--ink); }
.law[data-status='affordable']:hover .law-cost { background: var(--ink); color: var(--paper); }
.law[data-status='affordable'] .law-node { animation: acu-pulse 1.6s ease-in-out infinite; }

.law[data-status='locked'] .law-node { border-style: dashed; }
.law[data-status='locked'] .law-name { color: var(--ink-3); }

/* Секта */
.court { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr); gap: 22px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.court-box { text-align: center; }
.court-arrow { font-size: 20px; color: var(--ink-3); }
.court-action { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* Цены */
.cost { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; }
.cost-item { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.cost-item .glyph { font-size: 12px; color: var(--ink-3); }
.cost-name { color: var(--ink-2); }
.cost-missing .cost-name { color: inherit; }
.cost-ok { color: var(--ink); }
.cost-missing, .cost-missing .glyph { color: var(--ink-3); }
.cost-reward { color: var(--jade); }
.btn .cost-item, .btn .cost-item .glyph { color: inherit; }
.btn .cost-item { margin-left: 6px; }

/* Достижения */
.ach-summary { margin: 18px 0 14px; color: var(--ink-2); font-size: 14px; }
.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; }
.achievement {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 18px;
  border: 1px dashed var(--rule-strong); color: var(--rule-strong); border-radius: var(--radius);
}
.achievement.owned { border: 1px solid var(--ink); color: var(--ink); }

/* Летопись / настройки */
.stats-section, .settings-section { max-width: 560px; }
.settings-section.danger h3 { color: var(--cinnabar); }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.select, .textarea {
  background: transparent; color: var(--ink); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 6px 8px; font: inherit;
}
.select option { background: var(--paper); }
.textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; cursor: pointer; }
.check input { accent-color: var(--cinnabar); width: 15px; height: 15px; }
.help { color: var(--ink-2); font-size: 14px; padding-left: 18px; }

/* ----------------------------- лавка (правая колонна) ----------------------------- */

.upgrade-groups { display: flex; flex-direction: column; gap: 12px; padding: 0 18px; }
.upgrade-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.upgrade-group-title { font-size: 13px; }
.upgrade-group-hint { font-size: 11px; color: var(--ink-3); }
.upgrade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.empty-hint { padding: 0 18px; font-size: 13px; color: var(--ink-3); }
.upgrade {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--rule-strong); background: transparent; border-radius: var(--radius); color: var(--ink-3);
}
.upgrade { border-style: dashed; }
.upgrade.affordable { border-style: solid; border-color: var(--ink); color: var(--ink); }
.upgrade.affordable:hover { background: var(--ink); color: var(--paper); }
.upgrade.affordable:hover .upgrade-badge { color: var(--paper); }
.upgrade-glyph { font-size: 19px; }
.upgrade-badge { position: absolute; right: 3px; bottom: 1px; font-size: 9px; color: var(--ink-3); }

.gen-list { display: flex; flex-direction: column; padding: 0 18px 22px; }
.gen-row {
  appearance: none; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  text-align: left; cursor: pointer; padding: 9px 0; background: transparent; color: var(--ink-3);
  border: 0; border-bottom: 1px solid var(--rule);
}
.gen-group { display: flex; flex-direction: column; }
.gen-group + .gen-group, .gen-group + .gen-row { margin-top: 14px; }
.gen-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--ink); }
.gen-group-title { font-size: 13px; font-weight: 500; }
.gen-group-hint { font-size: 11px; color: var(--ink-3); text-align: right; }
.gen-best { display: none; margin-left: 8px; font-size: 10px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); border: 1px solid var(--rule-strong); padding: 0 5px; border-radius: var(--radius); vertical-align: 2px; }
.gen-row.best .gen-best { display: inline-block; }
.gen-row.affordable { color: var(--ink); }
.gen-row.affordable:hover { background: var(--paper-2); }
.gen-row.mystery { cursor: default; color: var(--rule-strong); }
.gen-glyph { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: var(--radius); }
.practice-icon { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pi-q { font-family: var(--font); font-size: 22px; fill: currentColor; stroke: none; }
.gen-row { position: relative; }
.gen-share { position: absolute; left: 50px; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.gen-share-fill { display: block; height: 100%; width: 0; background: var(--ink-3); transition: width 0.4s; }
.gen-row.affordable .gen-share-fill { background: var(--ink-2); }
.upgrade-more { appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--ink-3); font-size: 12px; padding: 6px 0 0; text-decoration: underline dotted; text-underline-offset: 3px; }
.upgrade-more:hover { color: var(--ink); }
.gen-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen-cost { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.gen-cost { line-height: 1.35; }
.gen-row.affordable .gen-cost-value { color: var(--ink); font-weight: 500; }
.gen-label { color: var(--ink-3); font-size: 12px; }
.gen-yield { color: var(--ink-3); font-size: 12px; }
.gen-owned { display: flex; flex-direction: column; align-items: flex-end; min-width: 3ch; }
.gen-owned-value { font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* ----------------------------- небесные знаки: оттиск печати ----------------------------- */

.omen-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.omen {
  position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; pointer-events: auto; cursor: pointer;
  border: 0; padding: 0; background: var(--cinnabar); color: var(--on-cinnabar); border-radius: 4px;
  transform: rotate(-4deg);
  animation: stamp 0.35s cubic-bezier(0.2, 1.6, 0.4, 1), drift 4s ease-in-out 0.35s infinite;
}
.omen-glyph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; padding-top: 4px; }
.omen::after { content: ''; position: absolute; inset: 4px; border: 1px solid var(--on-cinnabar); border-radius: 2px; opacity: 0.7; }
.omen:hover { background: var(--cinnabar-2); }
@keyframes stamp { from { transform: scale(1.6) rotate(-4deg); opacity: 0; } }
@keyframes drift { 50% { transform: translateY(-6px) rotate(-2deg); } }

/* ----------------------------- эффекты ----------------------------- */

.floater-layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.floater {
  position: absolute; transform: translate(-50%, -50%); color: var(--ink); font-size: 15px; white-space: nowrap;
  font-variant-numeric: tabular-nums; animation: float-up 0.9s ease-out forwards;
}
.floater.big { font-size: 24px; color: var(--cinnabar); }
@keyframes float-up { to { transform: translate(-50%, -80px); opacity: 0; } }
.particle {
  position: absolute; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: var(--ink);
  animation: particle 0.6s ease-out forwards;
}
@keyframes particle { to { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; } }
.no-particles .particle { display: none; }

/* «Вспышка» — тонкая черта по верху страницы, а не засветка экрана. */
.screen-flash {
  position: fixed; left: 0; right: 0; top: 0; height: 3px; pointer-events: none; z-index: 60;
  background: var(--cinnabar); transform-origin: left; animation: line-sweep 0.9s ease-out forwards;
}
.flash-jade { background: var(--jade); }
.flash-violet { background: var(--indigo); }
@keyframes line-sweep { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }

/* ----------------------------- тултип ----------------------------- */

.tooltip {
  position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none;
  max-width: 320px; padding: 12px 14px; font-size: 13px;
  background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius);
}
.tip-title { font-weight: 500; margin-bottom: 4px; font-size: 14px; }
.tip-desc { color: var(--ink-2); font-style: italic; margin-bottom: 6px; }
.tip-line { margin: 2px 0; }
.tip-sub { color: var(--ink-3); margin-top: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.tip-effects { margin: 4px 0; padding-left: 16px; }
.tip-cost { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--rule); color: var(--ink-2); }
.tip-cost.ok b { color: var(--ink); }
.tip-cost.missing b { color: var(--cinnabar); }
.tip-unlock { margin-top: 6px; color: var(--jade); }

/* ----------------------------- тосты ----------------------------- */

.toasts { position: fixed; right: var(--gutter); bottom: var(--gutter); z-index: 90; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; cursor: pointer; display: flex; gap: 12px; align-items: center;
  width: min(330px, calc(100vw - 2 * var(--gutter)));
  padding: 10px 14px; background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius);
  animation: toast-in 0.25s ease;
}
.toast.leaving { animation: toast-out 0.25s ease forwards; }
.toast-glyph { font-size: 20px; flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: var(--radius); }
.toast-gold .toast-glyph { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--on-cinnabar); }
.toast-jade .toast-glyph { color: var(--jade); border-color: var(--jade); }
.toast-violet .toast-glyph { color: var(--indigo); border-color: var(--indigo); }
.toast-crimson { border-color: var(--cinnabar); }
.toast-crimson .toast-glyph { color: var(--cinnabar); border-color: var(--cinnabar); }
.toast-title { font-weight: 500; font-size: 14px; }
.toast-body { font-size: 13px; color: var(--ink-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ----------------------------- модалки ----------------------------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: var(--gutter);
  background: color-mix(in srgb, var(--paper) 72%, transparent); animation: fade-in 0.2s ease;
}
.modal-overlay.leaving { animation: fade-out 0.2s ease forwards; }
.modal {
  width: min(430px, 100%); padding: 28px 26px 22px; text-align: center;
  background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius);
  outline: 1px solid var(--ink); outline-offset: 4px;
}
.modal-glyph {
  display: inline-grid; place-items: center; width: 56px; height: 56px; font-size: 32px; margin-bottom: 12px;
  background: var(--cinnabar); color: var(--on-cinnabar); border-radius: var(--radius); transform: rotate(-3deg);
}
.modal-title { font-size: 20px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink); margin-bottom: 10px; }
.modal-body { color: var(--ink-2); margin-bottom: 18px; }
.modal-body p { margin: 6px 0; }
.modal-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* ----------------------------- сцена восхождения ----------------------------- */

.scene { margin: 0 calc(-1 * var(--tab-pad)) 4px; position: relative; }
.scene .scene-caption { left: var(--tab-pad); }
.mountain { position: relative; display: block; width: 100%; height: clamp(220px, 28vw, 340px); color: var(--ink); overflow: hidden; }
/* Слои сцены: фон с фильтрами — отдельный композитный слой (рисуется один раз), туман дрейфует целиком. */
.m-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.m-bg { will-change: transform; }
.m-fog-layer { will-change: transform; animation: fog-drift 18s ease-in-out infinite alternate; pointer-events: none; }
.m-side { fill: var(--ink); opacity: 0.1; }
.m-sun { fill: var(--cinnabar); opacity: 0.85; }
.m-far { fill: var(--ink); opacity: 0.07; }
.m-mid { fill: var(--ink); opacity: 0.12; }
.m-main { fill: var(--ink); opacity: 0.2; }
.m-ridge { fill: none; stroke: var(--ink); stroke-width: 2; opacity: 0.25; }
.m-near { fill: var(--ink); opacity: 0.32; }
/* Туман — светлая дымка тушью (тема тёмная: «бумажный» туман резал горы тёмными полосами). */
.m-fog { fill: var(--ink); opacity: 0.07; }
.m-birds path { fill: none; stroke: var(--ink); stroke-width: 1.3; opacity: 0.6; }
.m-birds { animation: birds 30s linear infinite; }
.trail-todo { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 2 5; opacity: 0.45; }
.trail-done { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray 0.8s ease; }
.station circle { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; opacity: 0.7; }
.station.reached circle { fill: var(--ink); opacity: 1; }
.station-glyph { font-family: var(--font-brush); font-size: 17px; fill: var(--ink); opacity: 0.45; }
.station.reached .station-glyph { opacity: 0.9; }
.station.current .station-glyph { fill: var(--cinnabar); opacity: 1; }
.trail-marker rect { fill: var(--cinnabar); }
.trail-marker text { font-family: var(--font-brush); font-size: 13px; fill: var(--on-cinnabar); }
.trail-marker { transition: transform 0.8s ease; }
.scene-caption { position: absolute; left: 0; bottom: 4px; font-size: 13px; color: var(--ink-2); background: var(--paper); padding: 2px 8px 2px 0; }
/* «Путь»: подпись лежит на мягком затемнении низа кадра — без плашки поверх гор. */
.tab-path .scene::after { content: ''; position: absolute; right: 0; bottom: 0; width: 60%; height: 45%; pointer-events: none;
  background: radial-gradient(ellipse at 100% 100%, color-mix(in srgb, var(--paper) 90%, transparent), transparent 70%); }
/* Справа внизу: слева внизу начинается тропа восхождения с меткой текущей стадии. */
.tab-path .scene .scene-caption { z-index: 1; left: auto; right: var(--tab-pad); bottom: 14px; background: none; padding: 0; display: flex; flex-direction: row-reverse; align-items: center; gap: 12px; text-align: right; }
.sc-glyph { width: 40px; height: 40px; flex: none; display: grid; place-items: center; font-size: 24px; padding-top: 3px;
  background: var(--cinnabar); color: var(--on-cinnabar); border-radius: 3px; transform: rotate(-4deg); }
.sc-text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.sc-text b { font-size: 17px; font-weight: 500; color: var(--ink); }
.sc-text small { font-size: 12px; color: var(--ink-2); }
@keyframes fog-drift { from { transform: translateX(-14px); } to { transform: translateX(14px); } }
@keyframes birds { from { transform: translateX(40px); } to { transform: translateX(-120px); } }

.near-list { display: flex; flex-direction: column; }
.near-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.near-glyph { font-size: 18px; text-align: center; }
.near-name { font-size: 14px; }
.near-meta { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.near-mult { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.near-row.done { color: var(--ink-3); }
.near-row.next .near-name { font-weight: 500; }
.near-row.next { box-shadow: inset 3px 0 0 var(--cinnabar); padding-left: 10px; }
.near-row.later { color: var(--ink-2); }
.full-ladder { margin-top: 14px; }
.full-ladder summary { cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 6px 0; list-style: none; }
.full-ladder summary::before { content: '＋ '; color: var(--ink-3); }
.full-ladder[open] summary::before { content: '－ '; }
.full-ladder summary:hover { color: var(--ink); }

/* ----------------------------- печать прорыва ----------------------------- */

.seal-overlay {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  animation: seal-life 2.4s ease forwards;
}
.seal-splash { position: absolute; left: 50%; top: 50%; width: 520px; height: 520px; margin: -260px 0 0 -260px; color: var(--ink); opacity: 0.1; }
.seal-splash svg { width: 100%; height: 100%; animation: splash 2.4s ease-out forwards; }
.seal-stamp {
  position: relative; width: 150px; height: 150px; display: grid; place-items: center;
  background: var(--cinnabar); color: var(--on-cinnabar); border-radius: 4px; transform: rotate(-5deg);
  animation: seal-stamp 0.45s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.seal-stamp::after { content: ''; position: absolute; inset: 7px; border: 2px solid var(--on-cinnabar); border-radius: 2px; opacity: 0.8; }
.seal-stamp span { font-size: 104px; padding-top: 8px; }
.seal-jade .seal-stamp { background: var(--jade); }
.seal-indigo .seal-stamp { background: var(--indigo); }
.seal-title { position: relative; font-size: 26px; font-weight: 500; letter-spacing: 0.04em; background: var(--paper); padding: 0 12px; }
.seal-subtitle { position: relative; font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); background: var(--paper); padding: 0 10px; }
@keyframes seal-stamp { from { transform: scale(2.2) rotate(-12deg); opacity: 0; } }
@keyframes splash { from { transform: scale(0.3); } to { transform: scale(1.15); } }
@keyframes seal-life { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* ----------------------------- режим отладки ----------------------------- */

.debug-panel {
  position: fixed; left: 12px; bottom: 12px; z-index: 85; width: 300px; max-height: calc(100vh - 24px); overflow-y: auto;
  background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius); font-size: 12px;
}
.debug-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--paper); }
.debug-badge { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.12em; background: var(--ink); color: var(--paper); padding: 1px 6px; }
.debug-collapse { appearance: none; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font-size: 12px; }
.debug-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 10px; }
.debug-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); margin-bottom: 4px; }
.debug-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.debug-actions .btn { padding: 2px 8px; font-size: 12px; }
.debug-info { margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: 11px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; border-top: 1px solid var(--rule); padding-top: 8px; }
.debug-status { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--jade); min-height: 1em; }

/* ----------------------------- адаптив ----------------------------- */

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(250px, 290px) minmax(0, 1fr) minmax(290px, 340px); }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .tab-body { --tab-pad: 18px; padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 960px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  .topbar { padding: 10px var(--gutter); }
  .layout { display: flex; flex-direction: column; }
  .panel { overflow: visible; }
  .panel + .panel { border-left: 0; border-top: 1px solid var(--ink); }
  .panel-store { order: 2; }
  .panel-tabs { overflow: visible; order: 3; }
  .panel-tabs { display: flex; flex-direction: column; }
  .tabs { flex-direction: row; align-items: flex-start; padding: 8px var(--gutter); border-right: 0; border-bottom: 1px solid var(--rule); overflow-x: auto; }
  .tabs-main, .tabs-utility { flex-direction: row; }
  .tabs-utility { border-top: 0; border-left: 1px solid var(--rule); padding: 0 0 0 8px; margin: 0; }
  .tab-btn { border-left: 0; border-bottom: 2px solid transparent; min-width: 62px; }
  .tab-btn.active { border-bottom-color: var(--ink); }
  .tab-body { --tab-pad: var(--gutter); overflow: visible; padding: 4px var(--gutter) 24px; }
  .panel-head { padding: 16px var(--gutter) 10px; }
  .upgrade-groups, .empty-hint, .gen-list { padding-left: var(--gutter); padding-right: var(--gutter); }
  /* Телефон: даньтянь — главный герой экрана, крупно и по центру; Ци — над ним, как на компьютере. */
  .panel-cultivation { padding: 16px var(--gutter); gap: 14px; }
  .dantian { width: min(210px, 56vw); }
  .dantian-glyph { font-size: min(96px, 26vw); }
  .dantian-wrap { padding: 6px 0 2px; container-type: normal; }
  .dantian-wrap.wide { padding: 30px 0 4px; }
  .dantian-wrap.wide .dantian { max-width: none; }
  .dantian-wrap.wide .dantian-form { margin-top: 30px; }
  .debug-panel { left: 8px; right: 8px; width: auto; max-height: 50vh; }
  .realm-card { grid-area: realm; }
  .buffs { grid-area: buffs; }
  .bag { grid-area: bag; }
  .qi-amount { font-size: 32px; }
  .prestige-box { grid-template-columns: minmax(0, 1fr); }
  .court { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .court-action { grid-column: 1 / -1; }
  .tooltip { max-width: calc(100vw - 2 * var(--gutter)); }
}

@media (max-width: 480px) {
  .brand-name { display: none; }
  .dantian-hint { font-size: 12px; }
  .meridian-grid > *, .perk-grid > *, .card-grid > * { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ----------------------------- карта меридианов ----------------------------- */

.meridian-layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(280px, 1fr); gap: 28px; align-items: start; margin-top: 18px; }
.meridian-side .tab-intro { margin-top: 0; }
.meridian-figure { position: sticky; top: 0; }
.body-chart { display: block; width: 100%; height: auto; max-height: 560px; color: var(--ink); }
.body-halo { fill: none; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 1 5; animation: enso-turn 120s linear infinite; transform-origin: 160px 190px; }
.body-figure { fill: var(--ink); opacity: 0.16; }
.body-outline { fill: none; stroke: var(--ink); stroke-width: 1.2; opacity: 0.3; }
.body-dantian { fill: var(--cinnabar); opacity: 0.8; animation: breathe-core 8s ease-in-out infinite; transform-origin: 160px 246px; }

.channel { cursor: pointer; }
.channel-hit { fill: none; stroke: transparent; stroke-width: 12; }
.channel-line { fill: none; stroke: var(--ink); stroke-width: 1.2; opacity: 0.35; transition: opacity 0.2s, stroke-width 0.2s; }
/* Закрытые каналы всегда видны — бледным пунктиром, без точек. */
.channel.locked .channel-line { stroke-dasharray: 2 4; opacity: 0.28; }
.channel.locked .channel-points { display: none; }
.channel.locked.focus .channel-line { opacity: 0.7; }
.channel.affordable .channel-line { opacity: 0.85; stroke-width: 1.6; }
.acu.next { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; opacity: 1; transform-box: fill-box; transform-origin: center; animation: acu-pulse 1.6s ease-in-out infinite; }
@keyframes acu-pulse { 50% { transform: scale(1.7); } }
.channel.active .channel-line { opacity: 0.7; }
.channel.complete .channel-line { stroke: var(--cinnabar); opacity: 0.9; stroke-width: 1.8; }
.body-chart.has-focus .channel:not(.focus) .channel-line { opacity: 0.12; }
.body-chart.has-focus .channel:not(.focus) .acu { opacity: 0.3; }
.channel.focus .channel-line { opacity: 1; stroke-width: 2.4; }
.acu { fill: var(--paper); stroke: var(--ink); stroke-width: 1; opacity: 0.6; transition: fill 0.3s; }
.acu.open { fill: var(--ink); opacity: 1; }
.channel.complete .acu.open { fill: var(--cinnabar); stroke: var(--cinnabar); }
.channel.focus .acu { opacity: 1; }

.meridian-side h3:first-of-type { margin-top: 22px; }
.m-detail { display: flex; flex-direction: column; gap: 10px; padding: 16px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.m-detail-head { display: flex; gap: 14px; align-items: center; }
.m-detail-glyph { width: 52px; height: 52px; flex: none; display: grid; place-items: center; font-size: 34px; border: 1px solid var(--ink); border-radius: var(--radius); }
.m-detail.complete .m-detail-glyph { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--on-cinnabar); }
.m-detail-name { font-size: 17px; font-weight: 500; line-height: 1.25; }
.m-detail-sub { font-size: 13px; color: var(--ink-2); }
.m-detail .btn { align-self: flex-start; }
.m-detail.complete .acupoint.open { background: var(--cinnabar); border-color: var(--cinnabar); }
.m-detail .hint:empty { display: none; }
/* Стабильная высота карточки: эффекты и кнопка занимают место всегда. */
.m-detail .card-fx { min-height: 42px; }
.m-detail .btn.reserved { visibility: hidden; }
.m-detail .hint { margin: 0; min-height: 0; }

.m-list { display: flex; flex-direction: column; }
.m-row {
  appearance: none; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 64px; gap: 10px; align-items: center;
  padding: 6px 4px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; cursor: pointer; text-align: left; font-size: 13px;
}
.m-row:hover, .m-row.focus { background: var(--paper-2); }
.m-row.selected { box-shadow: inset 2px 0 0 var(--ink); }
.m-row.locked { color: var(--ink-3); }
.m-row-glyph { font-size: 14px; text-align: center; }
.m-row-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-dots { display: flex; gap: 3px; }
.mini-dot { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--ink-3); }
.mini-dot.on { background: var(--ink); border-color: var(--ink); }
.m-row.complete .mini-dot.on { background: var(--cinnabar); border-color: var(--cinnabar); }
.m-row-status { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12px; }
.m-row-status.affordable { color: var(--ink); font-weight: 500; }
.m-row.can .m-row-name { color: var(--ink); font-weight: 500; }
.m-row:not(.can):not(.complete):not(.locked) .m-row-name { color: var(--ink-2); }

.m-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.lg::before { content: ''; display: inline-block; width: 18px; height: 0; vertical-align: middle; margin-right: 6px; border-top: 2px solid var(--ink); }
.lg-wait::before { border-top-width: 1px; opacity: 0.5; }
.lg-done::before { border-top-color: var(--cinnabar); }
.lg-locked::before { border-top: 1px dashed var(--ink-3); }

@media (max-width: 1180px) {
  .meridian-layout { grid-template-columns: minmax(0, 1fr); }
  .meridian-figure { position: static; max-width: 420px; margin: 0 auto; }
}

/* ----------------------------- шапки вкладок с иллюстрацией ----------------------------- */

.hero { display: grid; grid-template-columns: minmax(160px, 240px) minmax(0, 1fr); gap: 28px; align-items: center; padding: 14px 0 18px; border-bottom: 1px solid var(--ink); }
.hero-art svg { display: block; width: 100%; height: auto; }
.hero-text .tab-intro { margin-top: 0; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; color: var(--ink-2); margin: 10px 0; }
.hero-stats b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.hero-next { padding-top: 10px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px; }
.hero-next:empty { display: none; }
.hero-next-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.hero-next-name { font-size: 16px; font-weight: 500; }
.tag-ok { font-size: 11px; color: var(--jade); border: 1px solid var(--jade); padding: 0 6px; margin-left: 6px; vertical-align: middle; }

.art .ink-fill { fill: var(--ink); opacity: 0.85; }
.art .ink-line { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; opacity: 0.85; }
.art .paper-line { fill: none; stroke: var(--paper); stroke-width: 2; opacity: 0.8; }
.art .paper-dot { fill: var(--paper); }
.belly-glyph { font-family: var(--font-brush); font-size: 34px; fill: var(--paper); }
.smoke path { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; opacity: 0; animation: smoke 4.5s ease-in infinite; }
.smoke path:nth-child(2) { animation-delay: 1.5s; }
.smoke path:nth-child(3) { animation-delay: 3s; }
.flames path { fill: var(--cinnabar); transform-box: fill-box; transform-origin: 50% 100%; animation: flicker 0.9s ease-in-out infinite alternate; }
.flames path:nth-child(2) { animation-duration: 0.7s; }
.flames path:nth-child(3) { animation-duration: 1.1s; }
@keyframes smoke { 0% { opacity: 0; transform: translateY(10px); } 30% { opacity: 0.8; } 100% { opacity: 0; transform: translateY(-18px); } }
@keyframes flicker { from { transform: scaleY(0.8) scaleX(1.05); } to { transform: scaleY(1.1) scaleX(0.92); } }

@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .hero-art { max-width: 220px; margin: 0 auto; }
}

/* Секта */
.sect-scene { margin-top: 0; }
.sect-scene { position: relative; }
.art-sect { display: block; width: 100%; height: clamp(200px, 22vw, 280px); }
.sect-bg { will-change: transform; }
.sect-fg { position: absolute; left: 0; top: 0; }
.m-near-sect { fill: var(--ink); opacity: 0.2; }
.art-sect .m-far { fill: var(--ink); opacity: 0.08; }
.art-sect .m-mid { fill: var(--ink); opacity: 0.13; }
.terrace { stroke: var(--ink); stroke-width: 1; opacity: 0.35; }
.stairs { fill: none; stroke: var(--ink); stroke-width: 1; opacity: 0.5; }
.pavilion .b-base, .pavilion .b-wall, .pavilion .b-roof { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.pavilion .b-door { fill: none; }
.pavilion .b-roof-2 { display: none; }
.pavilion .pav-glyph { font-family: var(--font-brush); font-size: 14px; fill: var(--ink-3); }
.pavilion.built .b-base, .pavilion.built .b-roof { fill: var(--ink); stroke: none; }
.pavilion.built .b-wall { fill: var(--paper); stroke: var(--ink); stroke-dasharray: none; stroke-width: 1.5; }
.pavilion.built .b-door { fill: var(--cinnabar); }
.pavilion.built .pav-glyph { fill: var(--ink); }
.pavilion.grand .b-roof-2 { display: inline; fill: var(--ink); stroke: none; }
.pavilion.grand rect.b-roof-2 { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.gate rect, .gate path { fill: var(--ink); }
.gate .gate-plaque { fill: var(--cinnabar); }
.gate-glyph { font-family: var(--font-brush); font-size: 12px; fill: var(--on-cinnabar); }
.disciples circle { fill: var(--ink); }
.exp-road { fill: none; stroke: var(--ink-3); stroke-width: 1.2; opacity: 0.6; }
.exp-flag { fill: var(--cinnabar); }
.exp-pole { stroke: var(--ink); stroke-width: 1; }
.exp-dot { fill: var(--ink); }

/* Артефакты */
.card-art { width: 56px; height: 56px; flex: none; display: grid; place-items: center; border: 1px solid var(--rule-strong); border-radius: var(--radius); }
.art-artifact { width: 46px; height: 46px; }
.art-artifact path, .art-artifact rect, .art-artifact circle { fill: var(--ink-3); }
.art-artifact .line { fill: none; stroke: var(--ink-3); stroke-width: 2.4; stroke-linecap: round; }
.art-artifact .paper-line { fill: none; stroke: var(--paper); stroke-width: 1.6; }
.art-artifact .paper-dot { fill: var(--paper); }
.card.forged .card-art { border-color: var(--ink); }
.card.forged .art-artifact path, .card.forged .art-artifact rect, .card.forged .art-artifact circle:not(.paper-dot) { fill: var(--ink); }
.card.forged .art-artifact .line { stroke: var(--ink); fill: none; }
.card.forged .art-artifact .paper-line { stroke: var(--paper); }
.card.perfect .card-art { background: var(--cinnabar); border-color: var(--cinnabar); }
.card.perfect .art-artifact path, .card.perfect .art-artifact rect, .card.perfect .art-artifact circle:not(.paper-dot) { fill: var(--on-cinnabar); }
.card.perfect .art-artifact .line { stroke: var(--on-cinnabar); }
.card.perfect .art-artifact .paper-line { stroke: var(--cinnabar); }
.card.perfect .art-artifact .paper-dot { fill: var(--cinnabar); }

/* Мистерии: багуа */
.hero-wide-art { grid-template-columns: minmax(240px, 360px) minmax(0, 1fr); }
.art-bagua { display: block; width: 100%; height: auto; }
.bagua-rim { fill: none; stroke: var(--rule-strong); stroke-width: 1; stroke-dasharray: 1 4; }
.trigrams rect { fill: var(--ink); opacity: 0.25; }
.taiji { animation: enso-turn 40s linear infinite; }
.taiji-yang { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.taiji-yin { fill: var(--ink); }
.bagua-link { stroke: var(--rule-strong); stroke-width: 1; stroke-dasharray: 2 4; }
.bagua-link.focused { stroke: var(--indigo); stroke-width: 2; stroke-dasharray: 6 6; animation: flow-in 1.2s linear infinite; }
@keyframes flow-in { to { stroke-dashoffset: 12; } }
.bagua-node { cursor: pointer; }
.node-ring-bg { fill: none; stroke: var(--rule); stroke-width: 3; }
.node-ring { fill: none; stroke: var(--indigo); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray 0.4s; }
.node-core { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1; }
.node-glyph { font-family: var(--font-brush); font-size: 26px; fill: var(--ink-3); }
.node-level { font-size: 11px; fill: var(--ink-2); }
.bagua-node.learned .node-core { stroke: var(--ink); }
.bagua-node.learned .node-glyph { fill: var(--ink); }
.bagua-node.focused .node-core { fill: var(--indigo); stroke: var(--indigo); }
.bagua-node.focused .node-glyph { fill: var(--paper); }
.bagua-node:hover .node-core { stroke-width: 2; }
.art-bagua.locked .bagua-node { cursor: default; opacity: 0.5; }

/* Колесо и врата */
.art-wheel { max-width: 200px; margin: 0 auto; }
.wheel-turn { animation: enso-turn 60s linear infinite; }
.wheel-rim { fill: none; stroke: var(--ink); stroke-width: 6; }
.wheel-rim.thin { stroke-width: 1.5; }
.wheel-spokes line { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.wheel-knobs circle { fill: var(--ink); }
.wheel-hub { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
.wheel-glyph { font-family: var(--font-brush); font-size: 22px; fill: var(--ink); }
.hero-art.ready .wheel-turn { animation-duration: 8s; }
.hero-art.ready .wheel-rim:not(.thin), .hero-art.ready .wheel-spokes line { stroke: var(--jade); }
.gate-light { fill: var(--ink); opacity: 0.06; }
.hero-art.ready .gate-light { fill: var(--cinnabar); opacity: 0.5; animation: breathe-core 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.clouds path { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1; animation: fog-drift 14s ease-in-out infinite alternate; }
.art-gate .gate-plaque { fill: var(--cinnabar); }
.art-gate .gate-glyph { font-size: 10px; }

@media (max-width: 960px) {
  .hero-wide-art { grid-template-columns: minmax(0, 1fr); }
  .bagua-wrap { max-width: 320px; margin: 0 auto; }
}

/* Пилюли прорыва — лестница строк */
.bp-list { display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.bp-row {
  display: grid; grid-template-columns: 44px minmax(130px, 0.8fr) minmax(280px, 1.7fr) auto; gap: 16px; align-items: center;
  padding: 12px 0 12px 10px; border-bottom: 1px solid var(--rule);
}
.bp-glyph { width: 40px; height: 40px; display: grid; place-items: center; font-size: 24px; border: 1px solid var(--ink); border-radius: var(--radius); padding-top: 2px; }
.bp-name { font-weight: 500; font-size: 14px; line-height: 1.3; }
.bp-realm { font-size: 12px; color: var(--ink-2); }
.bp-action { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bp-status { font-size: 12px; color: var(--ink-3); }
.bp-status.ready { color: var(--jade); font-weight: 500; }
.bp-status:empty { display: none; }
.bp-row.next { box-shadow: inset 3px 0 0 var(--cinnabar); background: var(--paper-2); }
.bp-row.next .bp-glyph { background: var(--ink); color: var(--paper); }
.bp-row.later { color: var(--ink-2); }
.bp-row.later .bp-glyph { color: var(--ink-3); border-color: var(--rule-strong); }
.bp-row.passed { padding-top: 6px; padding-bottom: 6px; color: var(--ink-3); }
.bp-row.passed .bp-glyph { width: 26px; height: 26px; font-size: 15px; border-color: var(--rule); color: var(--ink-3); margin-left: 7px; }
.bp-row.passed .bp-realm { display: none; }

.cost-bars { display: flex; flex-direction: column; gap: 5px; }
.cb-row { display: grid; grid-template-columns: 70px minmax(40px, 1fr) 124px; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-2); }
.cb-name .glyph { font-size: 11px; color: var(--ink-3); }
.cb-bar { height: 3px; background: var(--rule); position: relative; overflow: hidden; }
.cb-bar span { position: absolute; inset: 0 auto 0 0; background: var(--ink-2); }
.cb-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cb-row.cb-ok { color: var(--ink); }
.cb-row.cb-ok .cb-bar span { background: var(--jade); }

/* Дозы культивационных пилюль */
.doses { display: flex; gap: 4px; }
.dose { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--ink-3); }
.dose.on { background: var(--ink); border-color: var(--ink); }

@media (max-width: 960px) {
  .bp-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .bp-cost { grid-column: 2 / -1; grid-row: 2; }
  .bp-row.passed .bp-cost { display: none; }
}

/* ==========================================================================
   Время суток сцены, наставления, журнал, скорбь, вступление, события, испытания
   ========================================================================== */

.tab { animation: tab-in 0.25s ease; }
@keyframes tab-in { from { opacity: 0; transform: translateY(4px); } }

/* Время суток на горе */
.m-stars circle { fill: var(--ink); opacity: 0; transition: opacity 1.5s; }
.m-sun { transition: transform 2s ease, fill 2s, opacity 2s; transform-box: fill-box; transform-origin: center; }
.mountain.tod-0 .m-sun { transform: translate(-120px, 60px) scale(1.2); opacity: 0.75; }
.mountain.tod-1 .m-sun { transform: translate(0, 0); }
.mountain.tod-2 .m-sun { transform: translate(140px, 70px) scale(1.25); opacity: 0.7; }
.mountain.tod-3 .m-sun, .mountain.tod-4 .m-sun { fill: var(--ink); transform: translate(-60px, -10px) scale(0.75); opacity: 0.75; }
.mountain.tod-3 .m-stars circle { opacity: 0.35; }
.mountain.tod-4 .m-stars circle { opacity: 0.7; }
.mountain.tod-5 .m-stars circle { opacity: 0.5; fill: var(--cinnabar); }
.mountain.tod-5 .m-sun { transform: translate(-300px, -20px) scale(1.8); opacity: 0.55; }
.mountain.tod-3 .m-birds, .mountain.tod-4 .m-birds { opacity: 0; }

/* Наставления в шапке */
.topbar { gap: 20px; }
.goal-bar { flex: 1; min-width: 0; max-width: 760px; display: flex; align-items: center; gap: 12px; }
.goal-seal { width: 28px; height: 28px; flex: none; display: grid; place-items: center; font-size: 17px; border: 1px solid var(--ink); border-radius: var(--radius); padding-top: 2px; }
.goal-bar.done .goal-seal { background: var(--ink); color: var(--paper); }
.goal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.goal-line { display: flex; gap: 10px; align-items: baseline; font-size: 13px; white-space: nowrap; overflow: hidden; }
.goal-label { color: var(--ink-3); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; flex: none; }
.goal-text { overflow: hidden; text-overflow: ellipsis; }
.goal-count { color: var(--ink-2); font-variant-numeric: tabular-nums; flex: none; }
.goal-progress { height: 2px; background: var(--rule); }
.goal-fill { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.3s; }
.goal-claim { flex: none; background: var(--ink); color: var(--paper); animation: ready-glow 2s ease-in-out infinite; }
.goal-claim:hover { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--on-cinnabar); }
@keyframes ready-glow { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 20%, transparent); } }

/* Журнал */
.journal { position: relative; }
.journal-btn { appearance: none; display: flex; align-items: center; gap: 6px; border: 1px solid var(--rule-strong); background: transparent; color: var(--ink-2); cursor: pointer; padding: 3px 9px; border-radius: var(--radius); font-size: 13px; position: relative; }
.journal-btn:hover { color: var(--ink); border-color: var(--ink); }
/* Кнопки шапки рядом с журналом: «Установить» и Telegram автора — в том же стиле. */
.head-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule-strong); background: transparent; color: var(--ink-2); cursor: pointer; padding: 3px 9px; border-radius: var(--radius); font: inherit; font-size: 13px; text-decoration: none; }
.head-btn:hover { color: var(--ink); border-color: var(--ink); }
.head-btn[hidden] { display: none; }
.head-btn-glyph { font-size: 15px; line-height: 1; display: inline-grid; place-items: center; }
.head-btn-glyph svg { width: 15px; height: 15px; fill: currentColor; }
.install-btn { color: var(--ink); border-color: var(--ink); }
.install-btn:hover { background: var(--ink); color: var(--paper); }
.install-steps { text-align: left; margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.install-icon { display: inline-block; border: 1px solid var(--ink-3); border-radius: 3px; padding: 0 4px; font-size: 12px; }
.journal-btn .brush { font-size: 15px; }
.journal-btn.ping { animation: ping 0.5s ease; }
@keyframes ping { 40% { transform: translateY(-2px); } }
.journal-badge { min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--cinnabar); color: var(--on-cinnabar); font-size: 10px; display: grid; place-items: center; }
.journal-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 92; width: min(380px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius);
}
.journal-head { padding: 8px 12px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--paper); }
.journal-list { list-style: none; margin: 0; padding: 0; }
.journal-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--rule); font-size: 13px; }
.journal-glyph { font-size: 15px; color: var(--ink-2); text-align: center; }
.journal-body { font-size: 12px; color: var(--ink-2); }
.journal-time { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.journal-empty { padding: 14px 12px; color: var(--ink-3); font-size: 13px; }

/* Небесная скорбь */
.trib-overlay {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center;
  background: color-mix(in srgb, #0a0a0c 88%, transparent); color: #eee6d4; animation: fade-in 0.4s ease;
}
.trib-overlay.leaving { animation: fade-out 0.3s ease forwards; }
.trib-clouds { position: absolute; inset: 0 0 auto 0; height: 220px; pointer-events: none; }
.trib-clouds svg { width: 100%; height: 100%; }
.trib-clouds g { fill: #2a2a33; animation: fog-drift 9s ease-in-out infinite alternate; }
.trib-head { position: relative; z-index: 2; text-align: center; margin-top: 60px; max-width: 520px; padding: 0 16px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.trib-title { font-size: 24px; font-weight: 500; }
.trib-hint { font-size: 13px; color: #a9a08d; }
.trib-counter { font-size: 14px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.trib-field { position: relative; flex: 1; width: 100%; }
.trib-skip { position: absolute; bottom: 24px; right: 24px; color: #a9a08d; border-color: #5c5446; }
.trib-skip:hover { background: #eee6d4; color: #111; }
.trib-target { position: absolute; width: 84px; height: 84px; margin: -42px 0 0 -42px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.trib-ring { position: absolute; inset: -40px; border-radius: 50%; border: 2px solid #f1e7cf; animation: trib-ring var(--warn) linear forwards; }
.trib-core { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; color: #111; background: #f1e7cf; border-radius: 50%; padding-top: 4px; }
@keyframes trib-ring { from { transform: scale(1); opacity: 0.4; } to { transform: scale(0.45); opacity: 1; } }
.trib-bolt-wrap { position: absolute; inset: 0; pointer-events: none; }
.trib-bolt-wrap svg { width: 100%; height: 100%; }
.trib-bolt polyline { fill: none; stroke-width: 4; stroke-linejoin: bevel; animation: bolt 0.6s ease-out forwards; }
.trib-bolt.hit polyline { stroke: #fff6d8; filter: drop-shadow(0 0 6px #fff); }
.trib-bolt.miss polyline { stroke: #6d6a76; stroke-width: 2.5; }
@keyframes bolt { 0% { opacity: 1; } 100% { opacity: 0; } }
.trib-flash { position: absolute; width: 180px; height: 180px; margin: -90px 0 0 -90px; border-radius: 50%; pointer-events: none; animation: trib-flash 0.6s ease-out forwards; }
.trib-flash.hit { background: radial-gradient(circle, rgba(255, 246, 216, 0.9), transparent 65%); }
.trib-flash.miss { background: radial-gradient(circle, rgba(207, 74, 60, 0.5), transparent 65%); }
@keyframes trib-flash { from { transform: scale(0.4); } to { transform: scale(1.3); opacity: 0; } }
.trib-result { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; align-items: center; font-size: 15px; }
.trib-result-num { font-size: 48px; font-weight: 500; font-variant-numeric: tabular-nums; }
.trib-close { color: #111; background: #f1e7cf; border-color: #f1e7cf; }
.trib-close:hover { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--on-cinnabar); }

/* Вступление — «фильм» тушью: камера и параллакс в SVG (SMIL), титры и финал — CSS. */
.intro { position: fixed; inset: 0; z-index: 99; background: var(--paper); overflow: hidden; cursor: pointer; animation: fade-in 1s ease; }
.intro.leaving { animation: fade-out 0.8s ease forwards; }
.intro-stage { position: absolute; inset: 0; }
.intro-film { width: 100%; height: 100%; display: block; color: var(--ink); }
.if-drop-trail { stroke: var(--ink); stroke-width: 3; stroke-dasharray: 800; stroke-dashoffset: 800; stroke-linecap: round; }
.if-bloom { fill: var(--ink); }
.if-sun { fill: var(--cinnabar); }
.if-far path { fill: var(--ink); opacity: 0.13; }
.if-mid path { fill: var(--ink); opacity: 0.24; }
.if-clouds ellipse { fill: var(--ink); opacity: 0.07; }
.if-peak { fill: var(--ink); opacity: 0.8; }
.if-peak-snow { fill: var(--paper); opacity: 0.75; }
.if-trail { fill: none; stroke: var(--paper); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 1400; stroke-dashoffset: 1400; opacity: 0.85; }
.if-bank { fill: var(--ink); opacity: 0.92; }
.if-river path { fill: none; stroke: var(--paper); stroke-width: 1.2; stroke-linecap: round; opacity: 0.3; }
.if-pine path { fill: var(--ink); }
.if-figure circle:not(.if-spark):not(.if-spark-ring), .if-figure path { fill: var(--paper); }
.if-spark { fill: var(--cinnabar); }
.if-spark-ring { fill: none; stroke: var(--cinnabar); stroke-width: 0.8; }
.if-bolts path { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; opacity: 0; }
.if-crane path { fill: var(--ink); }
.if-crane .if-crane-neck { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
/* Широкоэкранные полосы — всегда тёмные, титры на них светлые (в обеих темах). */
.intro-bars::before, .intro-bars::after {
  content: ''; position: absolute; left: 0; right: 0; height: 11vh; background: #0f0d0a; z-index: 1;
  animation: bars-in 1.6s cubic-bezier(.2,.7,.2,1) both;
}
.intro-bars::before { top: 0; --from: -100%; }
.intro-bars::after { bottom: 0; --from: 100%; }
@keyframes bars-in { from { transform: translateY(var(--from)); } }
.intro-flash { position: absolute; inset: 0; background: #fffaf0; opacity: 0; pointer-events: none; z-index: 1;
  animation: intro-flash 1.6s linear 22.5s both; }
@keyframes intro-flash { 0%, 100% { opacity: 0; } 6% { opacity: 0.85; } 14% { opacity: 0; } 62% { opacity: 0; } 68% { opacity: 0.7; } 76% { opacity: 0; } }
.intro-subs { position: absolute; left: 0; right: 0; bottom: 0; height: 11vh; z-index: 2; display: grid; place-items: center; pointer-events: none; }
.intro-sub { grid-area: 1 / 1; margin: 0 24px; text-align: center; color: #efe6d2; font-size: clamp(14px, 2vw, 19px); line-height: 1.4; letter-spacing: 0.02em; opacity: 0; animation-name: intro-sub; animation-timing-function: linear; animation-fill-mode: both; }
@keyframes intro-sub { 0% { opacity: 0; transform: translateY(4px); } 12% { opacity: 1; transform: none; } 86% { opacity: 1; } 100% { opacity: 0; } }
.intro-final {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); opacity: 0; pointer-events: none;
  animation: fade-in 1.4s ease var(--film) both; animation-name: intro-final;
}
@keyframes intro-final { from { opacity: 0; } to { opacity: 1; } }
.intro.ended .intro-final { pointer-events: auto; }
.intro.skipped .intro-final { animation-delay: 0s; animation-duration: 0.6s; }
.intro.skipped .intro-sub, .intro.skipped .intro-flash { animation: none; opacity: 0; }
.intro-seal { font-size: clamp(64px, 12vw, 120px); line-height: 1; color: var(--on-cinnabar); background: var(--cinnabar); padding: 16px 24px 6px; border-radius: 6px; transform: rotate(-3deg); animation: stamp 0.7s cubic-bezier(.3,1.6,.5,1) calc(var(--film) + 0.5s) both; }
.intro.skipped .intro-seal { animation-delay: 0.2s; }
@keyframes stamp { from { transform: rotate(-3deg) scale(1.8); opacity: 0; } to { transform: rotate(-3deg) scale(1); opacity: 1; } }
.intro-title { font-size: 15px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-2); }
.intro-tagline { margin: 0; color: var(--ink-2); font-size: 17px; }
.intro-start { font-size: 16px; padding: 10px 26px; margin-top: 8px; }
.intro-skip { position: absolute; right: 20px; bottom: calc(11vh + 12px); z-index: 4; appearance: none; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font-size: 13px; text-decoration: underline dotted; text-underline-offset: 3px; }
.intro-skip:hover { color: var(--ink); }
.intro.ended .intro-skip { display: none; }

/* Событие у ворот секты */
.sect-event { display: flex; gap: 16px; align-items: flex-start; padding: 14px 16px; margin: 12px 0; border: 1px solid var(--ink); box-shadow: inset 3px 0 0 var(--cinnabar); }
.sect-event[hidden] { display: none; }
.sect-event-glyph { width: 46px; height: 46px; flex: none; display: grid; place-items: center; font-size: 28px; background: var(--ink); color: var(--paper); border-radius: var(--radius); padding-top: 3px; }
.sect-event-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cinnabar); }
.sect-event-title { font-size: 16px; font-weight: 500; }
.sect-event p { margin: 4px 0 10px; color: var(--ink-2); font-size: 14px; }
.opt-hint { color: var(--ink-3); font-size: 12px; }
.btn:hover .opt-hint { color: inherit; }

/* Испытания и пути */
.card.challenge.done .card-glyph { background: var(--jade); border-color: var(--jade); color: var(--paper); }
.card-glyph.brush { font-size: 22px; padding-top: 2px; }
.path-section { margin-bottom: 8px; }
.path-chosen { font-size: 15px; margin-bottom: 10px; display: flex; gap: 10px; align-items: center; }
.path-chosen .brush { width: 32px; height: 32px; display: grid; place-items: center; font-size: 20px; background: var(--ink); color: var(--paper); border-radius: var(--radius); padding-top: 2px; }

/* Печати достижений */
.ach-head { margin: 18px 0 6px; display: flex; flex-direction: column; gap: 8px; }
.ach-summary-text { color: var(--ink-2); font-size: 14px; }
.ach-bar { height: 3px; background: var(--rule); max-width: 420px; }
.ach-bar-fill { display: block; height: 100%; background: var(--cinnabar); width: 0; }
.seal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; }
.seal {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 20px; padding-top: 2px;
  border: 1px dashed var(--rule-strong); color: var(--rule-strong); border-radius: 3px;
}
.seal.owned { border: 0; background: var(--cinnabar); color: var(--on-cinnabar); box-shadow: inset 0 0 0 3px var(--cinnabar), inset 0 0 0 4px var(--on-cinnabar); }
.seal.owned:nth-child(3n) { transform: rotate(-3deg); }
.seal.owned:nth-child(3n + 1) { transform: rotate(2deg); }

/* Летопись */
.qps-graph svg { display: block; width: 100%; height: 160px; }
.graph-grid line { stroke: var(--rule); stroke-width: 1; }
.graph-area { fill: var(--ink); opacity: 0.08; }
.graph-line { fill: none; stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.graph-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.chronicle { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.chronicle li { position: relative; padding: 6px 0 6px 24px; font-size: 14px; display: flex; gap: 12px; align-items: baseline; }
.chronicle li::after { content: ''; position: absolute; left: 4px; top: 0; bottom: 0; border-left: 1px solid var(--ink); }
.chronicle li:last-child::after { bottom: 50%; }
.chronicle li:first-child::after { top: 50%; }
.chronicle li::before { content: ''; position: absolute; z-index: 1; left: 0; top: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink); }
.chronicle-time { font-size: 12px; color: var(--ink-3); min-width: 76px; font-variant-numeric: tabular-nums; }

.range { accent-color: var(--ink); width: 180px; }

@media (max-width: 960px) {
  .topbar { flex-wrap: wrap; }
  .goal-bar { order: 3; flex-basis: 100%; max-width: none; }
  .goal-line { white-space: normal; flex-wrap: wrap; justify-content: space-between; row-gap: 2px; }
  .goal-text { order: 3; flex: 1 1 100%; }
  .journal-label, .head-btn-label { display: none; }
  .header-chips { gap: 8px; }
}

/* ----------------------------- даньтянь в облике тела (карта меридианов) ----------------------------- */
.bf-layer { opacity: 0; transition: opacity 0.8s ease; }
.bf-layer.on { opacity: 1; }
.bf-shadow { fill: var(--ink); opacity: 0.1; }
.bf-lotus path { fill: var(--paper-2); stroke: var(--ink-2); stroke-width: 1.2; }
.bf-halo circle { fill: none; stroke: var(--ink); stroke-width: 2; opacity: 0.55; }
.bf-halo circle.thin { stroke-width: 0.8; stroke-dasharray: 2 4; }
.bf-void { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 1 6; animation: dt-void 10s ease-in-out infinite; }
.bf-rays line { stroke: var(--ink-2); stroke-width: 1.2; stroke-linecap: round; }
.bf-qi circle { fill: none; stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 5; }
.bf-core circle { fill: none; stroke: var(--cinnabar); stroke-width: 1.4; opacity: 0.7; }
.bf-soul circle { fill: none; stroke: var(--cinnabar); stroke-width: 0.8; stroke-dasharray: 2 3; opacity: 0.8; }
.bf-seal rect { fill: var(--cinnabar); }
.bf-seal text { fill: var(--on-cinnabar); font-family: var(--font-brush); font-size: 18px; }

/* ----------------------------- формации ----------------------------- */
.formation-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 18px; }
@media (min-width: 1500px) { .formation-layout { grid-template-columns: minmax(300px, 440px) minmax(0, 1fr); gap: 32px; align-items: start; } }
.formation-disk-wrap { max-width: 440px; width: 100%; margin: 0 auto; }
.formation-disk-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.formation-disk { width: 100%; height: auto; display: block; overflow: visible; }
.f-rim { fill: none; stroke: var(--ink); stroke-width: 2; }
.f-rim-inner { fill: color-mix(in srgb, var(--ink) 3%, transparent); stroke: var(--ink); stroke-width: 0.8; }
.f-ticks line { stroke: var(--ink-3); stroke-width: 1; }
.f-grid line { stroke: var(--rule-strong); stroke-width: 1; stroke-dasharray: 2 4; }
.f-link { stroke: none; stroke-width: 0; }
.f-link.gen { stroke: var(--ink); stroke-width: 2; }
.f-link.over { stroke: var(--cinnabar); stroke-width: 1.6; stroke-dasharray: 4 3; }
.f-arrow-head { fill: var(--ink); }
.f-cell { cursor: pointer; outline: none; }
.f-node { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; transition: stroke 0.2s; }
.f-eye-ring { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 1 3; }
.f-cell.eye .f-node { stroke: var(--ink-2); }
.f-cell.placeable:hover .f-node, .f-cell:focus-visible .f-node { stroke: var(--ink); stroke-dasharray: none; stroke-width: 1.5; }
.f-cell.filled .f-node { stroke: var(--ink); stroke-dasharray: none; stroke-width: 1.5; }
.f-cell.filled.strong .f-node { stroke-width: 3; }
.f-cell.filled.weak .f-node { stroke: var(--cinnabar); }
.f-glyph { font-family: var(--font-brush); font-size: 22px; fill: var(--ink); pointer-events: none; }
.f-power { font-size: 10px; fill: var(--ink); font-variant-numeric: tabular-nums; pointer-events: none; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
.f-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font-size: 12px; color: var(--ink-2); }
.lg-gen::before { border-top-color: var(--ink); }
.lg-over::before { border-top: 2px dashed var(--cinnabar); }
.lg-eye::before { border-top: 1px dotted var(--ink); }
.f-craft-cost { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 8px; }
.f-craft-cost .hint { margin: 0; }
.f-palette { display: flex; flex-wrap: wrap; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); margin-bottom: 8px; }
.f-row { flex: 1 1 200px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.f-chip { appearance: none; display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: transparent; padding: 2px 0; cursor: pointer; text-align: left; color: var(--ink); }
.f-chip-glyph { width: 34px; height: 34px; flex: none; display: grid; place-items: center; font-size: 22px; border: 1px solid var(--ink); border-radius: 50%; padding-top: 2px; }
.f-chip.selected .f-chip-glyph { background: var(--ink); color: var(--paper); }
.f-chip.empty .f-chip-glyph { border-style: dashed; color: var(--ink-3); border-color: var(--ink-3); }
.f-chip.empty.selected .f-chip-glyph { background: var(--ink-3); color: var(--paper); }
.f-chip-text { display: flex; flex-direction: column; min-width: 0; }
.f-chip-name { font-size: 14px; font-weight: 500; }
.f-chip-count { font-size: 12px; color: var(--ink-3); }
.f-row-fx { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.f-row-fx:empty { display: none; }
.art-wuxing { max-width: 200px; margin: 0 auto; display: block; }
.wx-node { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; }
.wx-glyph { font-family: var(--font-brush); font-size: 17px; fill: var(--ink); }
.wx-gen { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.wx-arrow-head { fill: var(--ink); }
.wx-over { stroke: var(--cinnabar); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.8; }

/* ----------------------------- звери ----------------------------- */
.art-egg { max-width: 200px; margin: 0 auto; display: block; }
.egg-nest { fill: var(--ink); opacity: 0.12; }
.egg-shell { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
.egg-spot { fill: var(--ink); opacity: 0.18; }
.egg-crack { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; opacity: 0; transition: opacity 0.6s; }
.egg-body { display: none; transform-box: fill-box; transform-origin: 50% 100%; }
.egg-empty { font-family: var(--font-brush); font-size: 64px; fill: var(--ink-3); opacity: 0.4; }
.art-egg.has-egg .egg-body { display: inline; animation: egg-rock 4s ease-in-out infinite; }
.art-egg.has-egg .egg-empty { display: none; }
.art-egg.crack-1 .c1, .art-egg.crack-2 .c2, .art-egg.crack-3 .c3 { opacity: 0.85; }
.art-egg.hatching .egg-body { animation-duration: 0.6s; }
@keyframes egg-rock { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2.5deg); } 75% { transform: rotate(2.5deg); } }
.beast-medallion { width: 46px; height: 46px; display: block; }
.bm-ring { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.bm-glyph { font-family: var(--font-brush); font-size: 28px; fill: var(--ink); }
.beast-medallion.r-legendary .bm-ring:first-child { stroke: var(--cinnabar); stroke-width: 1.6; }
.card.dim .beast-medallion .bm-ring, .card.dim .bm-glyph { stroke: var(--ink-3); fill: var(--ink-3); }
.card.dim .beast-medallion .bm-ring { fill: none; }

.companion-slots { display: flex; flex-wrap: wrap; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.companion-slot { flex: 1 1 200px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 14px; min-height: 70px; }
.companion-slot.empty, .companion-slot.locked { color: var(--ink-3); font-size: 13px; }
.slot-glyph { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border: 1px dashed var(--rule-strong); border-radius: 50%; font-family: var(--font-glyph); }
.slot-art svg { width: 46px; height: 46px; }
.slot-text b { font-weight: 500; }

/* ----------------------------- слияние Дао (хорды на багуа) ----------------------------- */
.dao-chord { fill: none; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 1 5; }
.dao-chord.active { stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: none; opacity: 0.7; }

/* ----------------------------- турнир сект ----------------------------- */
.tournament-box { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 28px; padding: 14px 0 6px; }
.t-formula { font-size: 12px; }
.t-main { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.t-rounds { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.t-round { display: grid; grid-template-columns: 130px minmax(0, 1fr) 44px; gap: 12px; align-items: center; font-size: 13px; }
.t-name { color: var(--ink-2); }
.t-bar { height: 3px; background: var(--rule); position: relative; }
.t-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ink); }
.t-chance { text-align: right; font-variant-numeric: tabular-nums; }
.t-last { font-size: 13px; }
.t-last:empty { display: none; }
.t-last-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.t-res { display: inline-block; margin-right: 12px; }
.t-res.won::before { content: '✓ '; color: var(--jade); }
.t-res.lost { color: var(--ink-3); }
.t-res.lost::before { content: '✗ '; }

/* ----------------------------- Вознесение ----------------------------- */
.art-palace { max-width: 240px; margin: 0 auto; display: block; }
.palace-halo { fill: var(--indigo); opacity: 0.08; }
.hero-art.ready .palace-halo { opacity: 0.2; animation: breathe-core 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.palace-door { fill: var(--cinnabar); }
.palace-plaque { font-family: var(--font-brush); font-size: 11px; fill: var(--paper); }
.palace-stairs { fill: none; stroke: var(--ink-3); stroke-width: 1.4; stroke-dasharray: 2 3; }
.art-palace .clouds path { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1; }
.palace-stars circle { fill: var(--ink-3); }
.big-number.indigo-ink { color: var(--indigo); }

/* ----------------------------- «Пока вас не было» ----------------------------- */
.off-list { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--rule); text-align: left; max-height: 40vh; overflow-y: auto; }
.off-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.off-glyph { grid-row: span 2; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: var(--radius); font-size: 15px; }
.off-title { font-size: 14px; font-weight: 500; }
.off-body { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.off-waiting { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); }

/* ----------------------------- сцена большого престижа ----------------------------- */
.cinematic { position: fixed; inset: 0; z-index: 98; background: var(--paper); display: grid; place-items: center; cursor: pointer; overflow: hidden; animation: fade-in 0.8s ease; }
.cinematic.leaving { animation: fade-out 0.6s ease forwards; }
.cine-art { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.cine-art svg { width: 100%; height: 70%; display: block; }
.cm-far { fill: var(--ink); opacity: 0.15; }
.cm-mid { fill: var(--ink); opacity: 0.3; }
.cm-near { fill: var(--ink); opacity: 0.6; }
.cm-trail { fill: none; stroke: var(--paper); stroke-width: 2; stroke-dasharray: 3 5; }
.cine-mountains { animation: cine-rise 3.6s ease-in 0.6s both; }
@keyframes cine-rise { to { transform: translateY(-60px); opacity: 0; } }
.cine-pillar { fill: var(--indigo); opacity: 0; animation: cine-pillar 3s ease 1.2s both; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes cine-pillar { from { opacity: 0; transform: scaleY(0); } to { opacity: 0.16; transform: scaleY(1); } }
.cine-clouds-left path, .cine-clouds-right path { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1.5; }
.cine-clouds-left { animation: cine-part-left 3.4s ease-in-out 0.6s both; }
.cine-clouds-right { animation: cine-part-right 3.4s ease-in-out 0.6s both; }
@keyframes cine-part-left { to { transform: translateX(-380px); } }
@keyframes cine-part-right { to { transform: translateX(380px); } }
.cine-palace > * { fill: var(--ink); }
.cine-palace { opacity: 0; animation: fade-in 2s ease 2.4s both; animation-name: cine-show; }
@keyframes cine-show { to { opacity: 0.85; } }
.cine-text { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 0 24px; }
.cine-line { margin: 0; font-size: clamp(15px, 2vw, 20px); color: var(--ink-2); opacity: 0; animation: intro-sub 2.6s linear both; }
.cine-line.l1 { animation-delay: 0.6s; }
.cine-line.l2 { animation-delay: 2.2s; }
.cine-seal { font-size: 84px; line-height: 1; color: var(--on-cinnabar); background: var(--cinnabar); padding: 14px 20px 4px; border-radius: 6px; animation: stamp 0.7s cubic-bezier(.3,1.6,.5,1) 3.6s both; }
.cine-ascend .cine-seal { background: var(--indigo); color: var(--paper); }
.cine-title { font-size: 14px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-2); opacity: 0; animation: fade-in 0.8s ease 4.2s both; animation-name: cine-show-full; }
.cine-amount { font-size: 30px; font-weight: 500; font-variant-numeric: tabular-nums; opacity: 0; animation: cine-show-full 0.8s ease 4.6s both; }
.cine-btn { opacity: 0; animation: cine-show-full 0.8s ease 5.4s both; }
@keyframes cine-show-full { to { opacity: 1; } }
.cinematic.done .cine-line { animation: none; opacity: 0; }
.cinematic.done .cine-seal, .cinematic.done .cine-title, .cinematic.done .cine-amount, .cinematic.done .cine-btn { animation: none; opacity: 1; }
.cinematic.done .cine-mountains { animation: none; opacity: 0; }
.cinematic.done .cine-clouds-left { animation: none; transform: translateX(-380px); }
.cinematic.done .cine-clouds-right { animation: none; transform: translateX(380px); }
.cinematic.done .cine-pillar { animation: none; opacity: 0.16; }
.cinematic.done .cine-palace { animation: none; opacity: 0.85; }

@media (max-width: 960px) {
  .formation-layout, .tournament-box { grid-template-columns: minmax(0, 1fr); }
  .formation-disk-wrap { max-width: 360px; margin: 0 auto; width: 100%; }
}

/* ----------------------------- поля ввода ----------------------------- */
.input {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--paper); padding: 6px 10px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); min-width: 0;
}
.input:focus { outline: none; border-color: var(--ink); }

/* ----------------------------- Зал славы ----------------------------- */
.hall-join { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hall-name { flex: 1 1 200px; max-width: 280px; }
.hall-leave { appearance: none; border: 0; background: transparent; color: var(--ink-3); font-size: 12px; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.hall-tabs { margin: 4px 0 8px; flex-wrap: wrap; }
.hall-list { list-style: none; margin: 0 0 8px; padding: 0; border-top: 1px solid var(--rule); }
.hall-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.hall-rank { width: 26px; height: 26px; display: grid; place-items: center; font-size: 12px; color: var(--ink-2); border: 1px solid var(--rule-strong); border-radius: 50%; font-variant-numeric: tabular-nums; }
.hall-row.top .hall-rank { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.hall-row:first-child .hall-rank { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--on-cinnabar); }
.hall-player { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hall-value { color: var(--ink-2); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.hall-row.me { background: color-mix(in srgb, var(--indigo) 8%, transparent); }
.hall-row.me .hall-player::after { content: ' — вы'; color: var(--indigo); }

/* ----------------------------- Небесный двор ----------------------------- */
.realm-court { font-size: 12px; color: var(--indigo); margin-top: 2px; }
.court-hero { grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); }
.court-seal-wrap { display: grid; place-items: center; padding: 10px 0; }
.court-seal {
  width: 120px; height: 120px; display: grid; place-items: center; font-size: 76px; padding-top: 8px;
  background: var(--indigo); color: var(--paper); border-radius: 6px; transform: rotate(-3deg);
  box-shadow: inset 0 0 0 5px var(--indigo), inset 0 0 0 7px var(--paper);
}
.court-title { font-size: 20px; font-weight: 500; }
.court-hero .progress { margin: 6px 0 10px; }
.commission-active { display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.commission-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.commission-row.empty { display: block; color: var(--ink-3); font-size: 13px; }
.commission-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.commission-merit { font-size: 13px; color: var(--indigo); font-variant-numeric: tabular-nums; }
.court-board-head { display: flex; align-items: center; gap: 12px; }
.court-board-head h3 { flex: 1; }
.rank-ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; border-top: 1px solid var(--rule); }
.rank-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--rule); color: var(--ink-3); font-size: 14px; }
.rank-glyph { width: 28px; height: 28px; display: grid; place-items: center; font-size: 17px; border: 1px dashed var(--ink-3); border-radius: var(--radius); padding-top: 2px; }
.rank-merit { font-size: 12px; font-variant-numeric: tabular-nums; }
.rank-row.done { color: var(--ink-2); }
.rank-row.done .rank-glyph { border: 1px solid var(--ink-2); }
.rank-row.current { color: var(--ink); font-weight: 500; }
.rank-row.current .rank-glyph { background: var(--indigo); color: var(--paper); border: 1px solid var(--indigo); }

/* ----------------------------- Малый мир ----------------------------- */
.world-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 8px; }
@media (min-width: 1500px) { .world-layout { grid-template-columns: minmax(320px, 460px) minmax(0, 1fr); align-items: start; gap: 28px; } }
.world-map-wrap { max-width: 460px; width: 100%; margin: 0 auto; }
.world-map { width: 100%; height: auto; display: block; }
.w-frame { fill: none; stroke: var(--ink); stroke-width: 2; }
.w-ground { fill: color-mix(in srgb, var(--ink) 4%, transparent); }
.w-cell { cursor: pointer; outline: none; }
.w-slot { fill: transparent; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 4; }
.w-cell.built .w-slot { stroke: none; }
.w-cell.buildable:hover .w-slot, .w-cell:focus-visible .w-slot { stroke: var(--ink); stroke-dasharray: none; fill: color-mix(in srgb, var(--ink) 6%, transparent); }
.w-ink { fill: var(--ink); }
.w-paper { fill: var(--paper); }
.w-line { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; }
.w-sprout { fill: none; stroke: var(--jade); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.w-field-bg { fill: color-mix(in srgb, var(--jade) 12%, transparent); stroke: var(--ink); stroke-width: 1.4; }
.w-wall { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; }
.w-door { fill: var(--cinnabar); }
.w-snow { fill: var(--paper); }
.w-river { fill: none; stroke: color-mix(in srgb, var(--indigo) 30%, var(--paper)); stroke-width: 22; stroke-linecap: round; }
.w-wave { fill: none; stroke: var(--paper); stroke-width: 1.4; stroke-dasharray: 4 6; animation: w-flow 2.4s linear infinite; }
.w-river-pool { fill: var(--indigo); opacity: 0.35; }
@keyframes w-flow { to { stroke-dashoffset: -20; } }
.w-person { fill: var(--cinnabar); animation: w-walk 6s ease-in-out infinite alternate; transform-box: fill-box; }
@keyframes w-walk { 0% { transform: translate(0, 0); } 33% { transform: translate(5px, -3px); } 66% { transform: translate(-4px, 4px); } 100% { transform: translate(3px, 2px); } }
.world-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.w-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.w-stat b { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.w-stat .hint { margin: 0; font-size: 12px; }
.w-stat-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.world-cost { color: var(--ink); font-weight: 500; }
.world-cost.missing { color: var(--ink-3); }
.w-palette { display: flex; flex-wrap: wrap; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); margin-top: 8px; }
.w-chip { flex: 1 1 200px; appearance: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: transparent; cursor: pointer; text-align: left; color: var(--ink); }
.w-chip:hover { background: var(--paper-2); }
.w-chip-glyph { width: 34px; height: 34px; flex: none; display: grid; place-items: center; font-size: 21px; border: 1px solid var(--ink); border-radius: var(--radius); padding-top: 2px; }
.w-chip.selected .w-chip-glyph { background: var(--ink); color: var(--paper); }
.w-chip-text { display: flex; flex-direction: column; min-width: 0; }
.w-chip-name { font-size: 14px; font-weight: 500; }
.w-chip-desc { font-size: 12px; color: var(--ink-3); }

.m-form { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 4px; cursor: help; }

/* ----------------------------- духовные звери тушью ----------------------------- */
.beast-art-svg { display: block; width: 100%; height: auto; overflow: visible; }
.bz-ink { fill: var(--ink); }
.bz-paper { fill: var(--paper); }
.bz-red { fill: var(--cinnabar); }
.bz-ground { fill: var(--ink); opacity: 0.1; }
.bz-line { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bz-line.thin { stroke-width: 1.8; }
/* Прорези «бумагой» по туши — стиль вырезанного силуэта. */
.bz-cut { fill: none; stroke: var(--paper); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bz-cut.thick { stroke-width: 2.6; }
.bz-dragon-spine { fill: none; stroke: var(--cinnabar); stroke-width: 4; stroke-dasharray: 3 5; stroke-linecap: round; }
.bz-dragon-belly { fill: none; stroke: var(--paper); stroke-width: 2; stroke-dasharray: 2 4; stroke-linecap: round; opacity: 0.7; }
.bz-flap { animation: bz-flap 1.4s ease-in-out infinite; }
.bz-coil { transform-box: fill-box; transform-origin: 50% 60%; animation: bz-coil 5s ease-in-out infinite; }
@keyframes bz-flap { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(16deg) scaleY(0.82); } }
@keyframes bz-coil { 0%, 100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(-2deg) translateY(-2px); } }
.bz-neck { fill: none; stroke: var(--ink); stroke-width: 4.2; stroke-linecap: round; }
.bz-tail-line { fill: none; stroke: var(--ink); stroke-width: 4.2; stroke-linecap: round; }
.bz-plume { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.bz-dragon-body { fill: none; stroke: var(--ink); stroke-width: 12; stroke-linecap: round; }
.bz-whisker { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linecap: round; }
.bz-flame { fill: var(--cinnabar); }
.bz-tail-cut { fill: var(--ink); stroke: var(--paper); stroke-width: 1.2; stroke-linejoin: round; }
.bz-question { font-family: var(--font-brush); font-size: 60px; fill: var(--ink-3); opacity: 0.5; }
/* Анимации: дыхание, моргание, кивок, хвосты, парение. */
.bz-breathe { transform-box: fill-box; transform-origin: 50% 100%; animation: bz-breathe 4.2s ease-in-out infinite; }
.bz-eye { transform-box: fill-box; transform-origin: center; animation: bz-blink 5.4s infinite; }
.bz-nod { animation: bz-nod 6s ease-in-out infinite; }
.bz-sway { animation: bz-sway 3.2s ease-in-out infinite; }
.bz-sway-slow { animation: bz-sway 5s ease-in-out infinite; }
.bz-peek { animation: bz-peek 7s ease-in-out infinite; }
.bz-hover { animation: bz-hover 3s ease-in-out infinite; }
.bz-pearl { animation: bz-hover 2.4s ease-in-out infinite; }
.bz-plume { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
@keyframes bz-breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.025); } }
@keyframes bz-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes bz-nod { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-4deg); } }
@keyframes bz-sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes bz-peek { 0%, 100% { transform: translateX(0); } 40%, 60% { transform: translateX(-6px); } }
@keyframes bz-hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
/* Зверинец: портрет слева, описание справа. */
.card-grid > .beast-card { flex-basis: 340px; }
.beast-card { flex-direction: row; align-items: flex-start; gap: 14px; }
.beast-portrait { width: 116px; height: 96px; flex: none; display: grid; place-items: center; }
.beast-portrait svg { width: 100%; height: 100%; }
.beast-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.beast-info .btn-row { margin: 4px 0 0; }
@media (max-width: 480px) {
  .beast-portrait { width: 84px; height: 70px; }
}
.card.dim .beast-portrait { opacity: 0.55; }
.slot-art { width: 72px; height: 58px; flex: none; display: grid; place-items: center; }
.slot-art svg { width: 100%; height: 100%; }
/* Звери свиты у даньтяня. */
.dantian-companion { position: absolute; z-index: 2; width: 70px; cursor: help; animation: fade-in 1s ease; }
.dantian-companion.pos-0 { left: 0; bottom: 30px; }
.dantian-companion.pos-1 { right: 0; bottom: 30px; transform: scaleX(-1); }
.dantian-companion.pos-2 { left: 4px; top: 10px; width: 60px; }
.dantian-companion.b-phoenix.pos-0, .dantian-companion.b-phoenix.pos-1 { bottom: auto; top: 6px; }
.dantian-companion.b-dragon { width: 84px; }
@media (max-width: 960px) {
  .dantian-companion { width: 58px; }
  .dantian-companion.pos-0 { left: 0; bottom: 34px; }
  .dantian-companion.pos-1 { right: 0; bottom: 34px; }
}

/* ----------------------------- каллиграфия прорыва ----------------------------- */
.calligraphy {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; animation: fade-in 0.4s ease;
}
.calligraphy.leaving { animation: fade-out 0.7s ease forwards; }
.cal-wash { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--paper) 94%, transparent) 0, color-mix(in srgb, var(--paper) 82%, transparent) 45%, transparent 75%); }
.cal-glyph { position: relative; width: min(360px, 70vw); aspect-ratio: 1; }
.cal-glyph svg { width: 100%; height: 100%; display: block; overflow: visible; }
.cal-glyph text { font-family: var(--font-brush); font-size: 190px; fill: var(--ink); }
.cal-strokes path { fill: none; stroke: white; stroke-width: 46; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: cal-stroke 0.42s cubic-bezier(.5,0,.3,1) forwards; }
@keyframes cal-stroke { to { stroke-dashoffset: 0; } }
.cal-name { position: relative; font-size: clamp(22px, 3.4vw, 34px); font-weight: 500; letter-spacing: 0.06em; }
.cal-name span { display: inline-block; opacity: 0; animation: cal-letter 0.5s ease forwards; }
@keyframes cal-letter { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
.cal-sub { position: relative; font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-2); opacity: 0; animation: fade-in 0.6s ease 2.4s forwards; animation-name: cal-show; }
@keyframes cal-show { to { opacity: 1; } }
.cal-seal {
  position: absolute; left: calc(50% + min(150px, 30vw)); top: calc(50% - min(40px, 8vw)); font-size: 20px; line-height: 1;
  writing-mode: vertical-rl; padding: 8px 5px; background: var(--cinnabar); color: var(--on-cinnabar); border-radius: 3px;
  opacity: 0; animation: stamp-in 0.5s cubic-bezier(.3,1.6,.5,1) 2.3s forwards;
}
@keyframes stamp-in { from { opacity: 0; transform: scale(1.8) rotate(-6deg); } to { opacity: 1; transform: rotate(-6deg); } }

/* ----------------------------- живой фон ----------------------------- */
#app { position: relative; z-index: 1; }
.ambient-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.amb-cloud { position: absolute; left: 0; width: 46vw; height: 9vw; min-height: 50px; opacity: 0.05; will-change: transform; animation: amb-drift linear infinite; }
.amb-cloud svg { width: 100%; height: 100%; display: block; overflow: visible; }
.amb-cloud path { fill: var(--ink); }
.amb-cloud.c0 { top: 14vh; animation-duration: 210s; animation-delay: -40s; }
.amb-cloud.c1 { top: 46vh; width: 36vw; animation-duration: 260s; animation-delay: -160s; opacity: 0.04; }
.amb-cloud.c2 { top: 72vh; width: 56vw; animation-duration: 300s; animation-delay: -90s; }
.amb-cloud.c3 { top: 30vh; width: 28vw; animation-duration: 180s; animation-delay: -10s; opacity: 0.035; }
@keyframes amb-drift { from { transform: translateX(-60vw); } to { transform: translateX(110vw); } }
.amb-crane { position: absolute; left: 0; width: 46px; opacity: 0.28; animation: amb-fly 28s linear forwards; }
.amb-crane svg { width: 100%; height: auto; display: block; transform: scale(var(--scale, 1)); }
.amb-crane-body { fill: var(--ink); }
.amb-crane-wing { fill: var(--ink); transform-box: fill-box; transform-origin: 50% 100%; animation: amb-flap 1.1s ease-in-out infinite; }
@keyframes amb-fly { from { transform: translate(-8vw, 4vh); } to { transform: translate(108vw, -6vh); } }
@keyframes amb-flap { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(-0.5); } }
.amb-petal { position: absolute; top: -20px; width: 7px; height: 4px; border-radius: 50%; background: var(--ink-3); opacity: 0.35; animation: amb-fall linear forwards; }
.amb-petal.red { background: var(--cinnabar); opacity: 0.3; }
@keyframes amb-fall {
  0% { transform: translate(0, 0) rotate(0); }
  50% { transform: translate(calc(var(--drift) * 0.6), 50vh) rotate(360deg); }
  100% { transform: translate(var(--drift), 105vh) rotate(720deg); opacity: 0; }
}

/* ----------------------------- свиток пути ----------------------------- */
.path-scroll { display: grid; grid-template-columns: 14px minmax(0, 1fr) 14px; align-items: stretch; margin: 6px 0 4px; }
.scroll-roller { border-radius: 7px; background: linear-gradient(90deg, var(--ink-2), var(--ink) 45%, var(--ink-2)); position: relative; margin: -8px 0; }
.scroll-roller::before, .scroll-roller::after { content: ''; position: absolute; left: 2px; right: 2px; height: 8px; border-radius: 3px; background: var(--cinnabar); }
.scroll-roller::before { top: -6px; }
.scroll-roller::after { bottom: -6px; }
.scroll-paper {
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent;
  background: color-mix(in srgb, var(--ink) 4%, var(--paper));
  border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong);
}
.path-scroll.unroll .scroll-paper { animation: unroll 1.4s cubic-bezier(.3,.7,.2,1) both; }
@keyframes unroll { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.scroll-track { list-style: none; margin: 0; padding: 14px 10px; display: flex; gap: 0; width: max-content; min-width: 100%; position: relative; }
.scroll-track::before { content: ''; position: absolute; left: 0; right: 0; top: 92px; border-top: 1px dashed var(--rule-strong); }
.scroll-entry { position: relative; width: 150px; flex: none; padding: 0 10px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; border-right: 1px solid var(--rule); }
.scroll-entry:last-child { border-right: 0; }
.scroll-entry.fresh { animation: fade-in 1.2s ease; }
.scroll-vignette { width: 90px; height: 70px; }
.sv-art { width: 100%; height: 100%; display: block; }
.scroll-time { position: relative; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--ink) 4%, var(--paper)); padding: 0 6px; margin-top: 6px; }
.scroll-text { font-size: 12.5px; line-height: 1.35; color: var(--ink-2); }
.scroll-empty { padding: 20px; }
.sv-ink { fill: var(--ink); }
.sv-far { fill: var(--ink); opacity: 0.15; }
.sv-trail { fill: none; stroke: var(--paper); stroke-width: 1.4; }
.sv-seal, .sv-red { fill: var(--cinnabar); }
.sv-court { fill: var(--indigo); }
.sv-seal-text { font-family: var(--font-brush); font-size: 16px; fill: var(--on-cinnabar); }
.sv-seal-text.big { font-size: 26px; }
.sv-rim { fill: none; stroke: var(--ink); stroke-width: 3; }
.sv-rim.thin { stroke-width: 1; }
.sv-spoke { stroke: var(--ink); stroke-width: 2; }
.sv-hub { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.sv-light { fill: var(--indigo); opacity: 0.18; }
.sv-wall { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.sv-cloud { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1.2; }
.sv-glyph { font-family: var(--font-brush); font-size: 24px; fill: var(--ink); }

/* ----------------------------- сцена Небесного двора ----------------------------- */
.court-scene { margin-top: 0; }
.court-layers { position: relative; }
.art-court { display: block; width: 100%; height: clamp(190px, 21vw, 260px); }
.court-bg { will-change: transform; }
.court-fg { position: absolute; left: 0; top: 0; }
.cs-stars circle { fill: var(--ink-3); opacity: 0.6; }
.cs-moon { fill: var(--indigo); opacity: 0.18; }
.cs-cloud-far path { fill: var(--ink); opacity: 0.06; }
.cs-cloud-near path { fill: var(--paper); stroke: var(--rule-strong); stroke-width: 1.2; }
.cs-path { fill: none; stroke: var(--ink-3); stroke-width: 1.2; opacity: 0.6; stroke-dasharray: 1 5; stroke-linecap: round; }
.cs-platform { fill: var(--paper); stroke: var(--ink-2); stroke-width: 1.4; }
.cs-roof, .cs-ink { fill: var(--ink); }
.cs-door { fill: var(--cinnabar); }
.cs-plaque { fill: var(--indigo); }
.cs-plaque-text { font-family: var(--font-brush); font-size: 10px; fill: var(--paper); }
.cs-steps { stroke: var(--ink-2); stroke-width: 1; }
.cs-head { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.cs-hat { fill: var(--ink); stroke: var(--ink); stroke-width: 1.2; stroke-linecap: round; }
.cs-robe { fill: var(--indigo); }
.cs-tablet { stroke: var(--paper); stroke-width: 1.4; stroke-linecap: round; }
.cs-banner { fill: var(--cinnabar); stroke: var(--ink); stroke-width: 0.8; }
.cs-official.walking .cs-robe { animation: cs-step 0.9s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 0; }
@keyframes cs-step { from { transform: skewX(-6deg); } to { transform: skewX(6deg); } }

/* ----------------------------- облачное сохранение ----------------------------- */
.cloud-login { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.cloud-login .input { flex: 1 1 220px; max-width: 320px; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.04em; }
.cloud-code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.cloud-code-row .hint { margin: 0; }
.cloud-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; letter-spacing: 0.06em; padding: 3px 8px; border: 1px dashed var(--rule-strong); border-radius: var(--radius); user-select: all; }
.cloud-conflict p { margin: 0 0 10px; }
.cloud-choice { text-align: left; font-size: 14px; padding: 6px 0; border-top: 1px solid var(--rule); }
.cloud-choice b { font-weight: 500; }
