/* =========================================================
   БЕСТИАРИЙ — оккультный гримуар
   Чёрная кожа, золотое тиснение, угли, печати и руны.
   Цвет раздела (--ac) меняется по выбранному разделу книги.
   ========================================================= */

.bk-page {
  --bg: #070504;
  --leather: #110b08;
  --bone: #eadfc6;
  --bone-2: #c4b89c;
  --bone-3: #8f846c;
  --gold: #d9b45c;
  --gold-hi: #f7e4a4;
  --gold-lo: #8c6a26;
  --wine: #4a1218;
  --ac: #e2703a;
  --ac-rgb: 226,112,58;

  --f-title: 'Ruslan Display', 'Alegreya SC', Georgia, serif;
  --f-name: 'Alegreya SC', Georgia, serif;
  --f-ui: 'Cormorant SC', Georgia, serif;
  --f-body: 'Alegreya', 'EB Garamond', Georgia, serif;
  --f-hand: 'Marck Script', 'Alegreya', cursive;
  --f-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --ease: cubic-bezier(.22,.8,.22,1);

  background: var(--bg);
  background-image: none;
  color: var(--bone);
  font-family: var(--f-body);
  font-size: 18px;
  line-height: 1.65;
}
.bk-page [hidden] { display: none !important; }
.bk-page ::selection { background: rgba(var(--ac-rgb), .55); color: #fff; }
.bk-page button { font-family: inherit; }
.bk-page svg { display: block; }

/* --- сквозные слои: угли, свет свечи, зерно кожи --- */
.bk-embers { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.bk-shade {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 1100px 520px at 50% -6%, rgba(var(--ac-rgb), .10), transparent 62%),
    radial-gradient(ellipse 1300px 460px at 50% 114%, rgba(var(--ac-rgb), .18), transparent 66%),
    radial-gradient(ellipse at 50% 42%, transparent 52%, rgba(0,0,0,.72) 100%);
  transition: opacity .55s ease;
}
.bk-shade::after {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 .9  0 0 0 0 .75  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .055; mix-blend-mode: screen;
}
.bk-shade::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 760px 520px at 18% 6%, rgba(255,170,90,.10), transparent 70%);
  animation: candle 5.3s steps(1, end) infinite;
}
@keyframes candle {
  0% { opacity: .85; } 9% { opacity: 1; } 17% { opacity: .78; } 26% { opacity: .95; } 38% { opacity: .82; }
  47% { opacity: 1; } 59% { opacity: .88; } 71% { opacity: .98; } 83% { opacity: .8; } 92% { opacity: .96; } 100% { opacity: .85; }
}

.bk-page .site-header { position: sticky; top: 0; z-index: 120; background: rgba(8,6,4,.86); backdrop-filter: blur(8px); border-bottom-color: rgba(217,180,92,.16); }
.bk-page .site-nav a.active { color: var(--gold-hi); }
.bk-page .site-nav:not(.nav-fx) a.active { border-color: var(--gold); }
.bk-page .site-footer { position: relative; z-index: 2; background: rgba(6,4,3,.82); border-top-color: rgba(217,180,92,.16); }
.bk-main { position: relative; z-index: 2; }

/* --- кнопки --- */
.bk-btn {
  position: relative; display: inline-flex; align-items: center; gap: 9px; justify-content: center;
  font-family: var(--f-ui); font-weight: 700; font-size: 14.5px; letter-spacing: .14em; text-transform: uppercase;
  padding: 10px 18px; border-radius: 2px; cursor: pointer; overflow: hidden; line-height: 1.15;
  border: 1px solid rgba(217,180,92,.45); background: transparent; color: var(--gold-hi);
  transition: transform .25s var(--ease), box-shadow .3s ease, border-color .3s ease, background .3s ease, color .3s ease;
}
.bk-btn svg { width: 17px; height: 17px; flex: none; }
.bk-btn:hover { border-color: var(--gold); box-shadow: 0 0 22px rgba(217,180,92,.22); transform: translateY(-1px); }
.bk-btn:active { transform: translateY(1px); }
.bk-btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.bk-btn-gold {
  color: #1b1208; border-color: transparent;
  background: linear-gradient(160deg, #f7e4a4 0%, #d9b45c 48%, #a77c2c 100%);
  box-shadow: 0 6px 24px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.4);
}
.bk-btn-gold:hover { color: #1b1208; filter: brightness(1.07); box-shadow: 0 8px 34px rgba(217,180,92,.35), inset 0 1px 0 rgba(255,255,255,.5); }
.bk-btn-gold::after, .bk-btn-ember::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 46%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-18deg); transition: left .7s var(--ease);
}
.bk-btn-gold:hover::after, .bk-btn-ember:hover::after { left: 120%; }
.bk-btn-ember { color: #ffd9bd; border-color: rgba(226,112,58,.7); background: linear-gradient(160deg, rgba(226,112,58,.22), rgba(120,40,16,.25)); animation: emberPulse 3.6s ease-in-out infinite; }
.bk-btn-ember:hover { color: #fff; border-color: #ff8f55; }
@keyframes emberPulse { 0%,100% { box-shadow: 0 0 0 rgba(226,112,58,0); } 50% { box-shadow: 0 0 22px rgba(226,112,58,.38); } }
.bk-btn-ghost { color: var(--bone-2); border-color: rgba(217,180,92,.28); }
.bk-btn-ghost.is-on { color: #1b1208; background: linear-gradient(160deg, #f7e4a4, #d9b45c); border-color: transparent; }

/* =========================================================
   ОБЛОЖКА: закрытый гримуар
   ========================================================= */
.bk-cover {
  position: relative; min-height: calc(100vh - 76px); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 38px; padding: 48px 18px 70px; overflow: hidden;
  transition: opacity .9s ease, transform 1s var(--ease), filter .9s ease;
}
.bk-cover.is-leaving { opacity: 0; transform: scale(1.25); filter: blur(6px); pointer-events: none; }
.cover-glow {
  position: absolute; left: 50%; top: 44%; width: min(1100px, 130vw); height: 620px; transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(226,112,58,.20), rgba(150,60,20,.08) 42%, transparent 70%);
  animation: coverGlow 6s ease-in-out infinite; pointer-events: none;
}
@keyframes coverGlow { 0%,100% { opacity: .75; transform: translate(-50%,-50%) scale(1); } 50% { opacity: 1; transform: translate(-50%,-50%) scale(1.06); } }

.tome-stage { position: relative; width: min(430px, 78vw); aspect-ratio: 3 / 4.15; perspective: 2400px; }
.tome {
  position: absolute; inset: 0; transform-style: preserve-3d; cursor: pointer; outline: none;
  transform: rotateY(-16deg) rotateX(5deg);
  animation: tomeIdle 7.5s ease-in-out infinite;
  transition: transform 1.7s cubic-bezier(.5,.05,.2,1);
}
@keyframes tomeIdle {
  0%,100% { transform: rotateY(-16deg) rotateX(5deg) translateY(0); }
  50%     { transform: rotateY(-11deg) rotateX(3deg) translateY(-9px); }
}
.tome:hover, .tome:focus-visible { animation-play-state: paused; transform: rotateY(-7deg) rotateX(2deg); }
.tome:focus-visible .tc-front { box-shadow: inset 0 0 0 2px var(--gold-hi), inset 0 0 60px rgba(0,0,0,.7); }
.tome.is-open { animation: none; transform: translateX(50%) rotateY(0deg) rotateX(2deg) scale(1.06); }

.tome-pages {
  position: absolute; inset: 0; border-radius: 2px 7px 7px 2px; transform: translateZ(0);
  background: linear-gradient(90deg, #120c08, #1d150e 40%, #140e09);
  box-shadow: 1px 0 0 #3a2d1f, 2px 0 0 #1b130c, 3px 0 0 #3a2d1f, 4px 0 0 #1b130c, 5px 0 0 #2d2216, 6px 1px 0 #120c08, 7px 2px 0 #3a2d1f, 8px 3px 0 #0e0906, 9px 4px 0 #20170f, 10px 5px 0 #080504;
}
.tome-page-lines {
  position: absolute; inset: 7% 9% 8% 9%;
  background:
    radial-gradient(circle at 50% 38%, transparent 0 22%, rgba(217,180,92,.38) 22.4% 23%, transparent 23.4% 31%, rgba(217,180,92,.22) 31.4% 32%, transparent 32.4%),
    repeating-linear-gradient(180deg, transparent 0 22px, rgba(217,180,92,.14) 22px 23px);
  mask-image: linear-gradient(180deg, #000, rgba(0,0,0,.5));
}

.tome-cover { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; transform: translateZ(14px); transition: transform 1.7s cubic-bezier(.5,.05,.2,1); }
.tome.is-open .tome-cover { transform: translateZ(14px) rotateY(-169deg); }
.tc-front, .tc-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 3px 10px 10px 3px; }
.tc-front {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; text-align: center; padding: 0 28px 11%;
  background:
    radial-gradient(ellipse at 28% 14%, rgba(255,214,150,.13), transparent 52%),
    radial-gradient(ellipse at 82% 92%, rgba(0,0,0,.6), transparent 56%),
    linear-gradient(155deg, #21160f 0%, #130d09 48%, #0a0705 100%);
  box-shadow: inset 0 0 0 1px rgba(217,180,92,.3), inset 0 0 70px rgba(0,0,0,.75), inset 4px 0 8px rgba(255,220,160,.07), 0 24px 60px rgba(0,0,0,.6);
  overflow: hidden;
}
.tc-front::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: overlay; opacity: .75;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='l'><feTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' seed='4'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .4  0 0 0 0 .3  0 0 0 1.4 -.35'/></filter><rect width='100%' height='100%' filter='url(%23l)'/></svg>");
}
.tc-front::after {
  content: ""; position: absolute; inset: 15px; pointer-events: none;
  border: 1.5px solid rgba(217,180,92,.6); box-shadow: inset 0 0 0 5px rgba(0,0,0,0), inset 0 0 0 6px rgba(217,180,92,.2), 0 0 18px rgba(217,180,92,.08);
}
.tc-corner { position: absolute; width: 50px; height: 50px; color: var(--gold); z-index: 2; filter: drop-shadow(0 0 6px rgba(217,180,92,.4)); }
.tc-corner.c1 { top: 24px; left: 24px; }
.tc-corner.c2 { top: 24px; right: 24px; transform: scaleX(-1); }
.tc-corner.c3 { bottom: 24px; left: 24px; transform: scaleY(-1); }
.tc-corner.c4 { bottom: 24px; right: 24px; transform: scale(-1); }
.tc-emblem { position: absolute; left: 50%; top: 9%; width: 62%; aspect-ratio: 1; transform: translateX(-50%); z-index: 2; }
.tc-emblem svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 10px rgba(217,180,92,.35)); }
.tc-title {
  position: relative; z-index: 2; margin: 0; font-family: var(--f-title); font-weight: 400; text-transform: uppercase;
  /* книга = min(430px, 78vw) шириной; надпись должна занимать ~74% и не выходить за золотую рамку */
  font-size: min(47px, 8.6vw); letter-spacing: .06em; line-height: 1; white-space: nowrap;
  background: linear-gradient(100deg, #8c6a26 0%, #f7e4a4 28%, #c9972f 46%, #fff3c4 58%, #8c6a26 78%, #d9b45c 100%);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: foil 6s linear infinite;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.7)) drop-shadow(0 0 16px rgba(217,180,92,.3));
}
@keyframes foil { to { background-position: -260% 0; } }
.tc-sub { position: relative; z-index: 2; margin: 12px 0 0; font-family: var(--f-ui); font-weight: 600; font-size: clamp(13px, 2.6vw, 16px); letter-spacing: .26em; text-transform: uppercase; color: var(--gold); opacity: .85; }
.tc-div { position: relative; z-index: 2; width: 150px; height: 14px; margin-top: 14px; color: var(--gold); opacity: .8; }
.tc-clasp {
  position: absolute; right: -2px; top: 47%; width: 30px; height: 74px; z-index: 3; border-radius: 5px 0 0 5px;
  background: linear-gradient(90deg, #8c6a26, #f7e4a4 45%, #a77c2c); box-shadow: -4px 4px 14px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .6s var(--ease), opacity .6s ease;
}
.tc-clasp i { position: absolute; left: 7px; top: 29px; width: 12px; height: 16px; border-radius: 50% 50% 4px 4px; background: #130d09; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.tc-clasp i::after { content: ""; position: absolute; left: 4px; top: 10px; width: 4px; height: 9px; background: #130d09; border-radius: 1px; }
.tome.is-open .tc-clasp, .tome.is-unlocked .tc-clasp { transform: translateX(14px) rotate(14deg); opacity: 0; }
.tc-back {
  transform: rotateY(180deg);
  background: linear-gradient(210deg, #1b120c, #0e0906);
  box-shadow: inset 0 0 0 1px rgba(217,180,92,.22), inset 0 0 60px rgba(0,0,0,.7);
}
.tc-back-pattern {
  position: absolute; inset: 16px; border: 1px solid rgba(217,180,92,.3);
  background:
    repeating-linear-gradient(45deg, rgba(217,180,92,.07) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(-45deg, rgba(217,180,92,.07) 0 2px, transparent 2px 14px);
}
.tome-spine { position: absolute; left: -7px; top: 2px; bottom: 2px; width: 16px; transform: translateZ(7px); border-radius: 6px 0 0 6px; background: linear-gradient(90deg, #060403, #1a1109 40%, #0a0705); box-shadow: inset 2px 0 0 rgba(217,180,92,.3), -4px 0 14px rgba(0,0,0,.5); }
.tome-shadow { position: absolute; left: 4%; right: -6%; bottom: -26px; height: 36px; background: radial-gradient(ellipse at 50% 50%, rgba(0,0,0,.75), transparent 70%); filter: blur(6px); transition: transform 1.7s cubic-bezier(.5,.05,.2,1), opacity .6s; }
.tome-stage.is-open .tome-shadow { transform: scaleX(1.9) translateX(18%); }

.cover-cta { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; max-width: 560px; }
.cover-cta .bk-btn { font-size: 16px; padding: 14px 34px; }
.cover-hint { margin: 0; color: var(--bone-3); font-size: 16px; line-height: 1.55; font-style: italic; }

/* =========================================================
   ГРИМУАР: основа интерфейса
   ========================================================= */
.bk-app { position: relative; animation: appIn 1.1s var(--ease) both; }
@keyframes appIn { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
.bk-wrap { position: relative; max-width: 1260px; margin: 0 auto; padding: 0 28px 90px; }

/* верхняя панель с ленточными закладками */
.bk-appbar {
  position: relative; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px 24px;
  padding: 32px 0 24px; border-bottom: 1px solid rgba(217,180,92,.28); margin-bottom: 96px;
}
.bk-appbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: rgba(217,180,92,.12); }
.bk-title-mini { display: flex; align-items: center; gap: 14px; }
.btm-mark { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ac); border: 1px solid rgba(var(--ac-rgb), .5); border-radius: 50%; box-shadow: 0 0 22px rgba(var(--ac-rgb), .3), inset 0 0 14px rgba(var(--ac-rgb), .15); transition: color .6s, border-color .6s, box-shadow .6s; }
.btm-mark svg { width: 24px; height: 24px; }
.btm-text { display: flex; flex-direction: column; line-height: 1.1; }
.btm-text b { font-family: var(--f-title); font-weight: 400; font-size: 26px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-hi); }
.btm-text small { font-family: var(--f-ui); font-size: 13px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--bone-3); margin-top: 4px; }

.bk-tabs { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 5; filter: drop-shadow(0 8px 10px rgba(0,0,0,.55)); }
.bk-tab {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 96px; padding: 14px 16px 30px;
  background: linear-gradient(180deg, #3a0f14, #561a20 70%, #3d1015); border: 0; cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 13px), 0 100%);
  color: #e6c9b8; font-family: var(--f-ui); font-weight: 700; font-size: 13.5px; letter-spacing: .14em; text-transform: uppercase;
  transform: translateY(-18px); transition: transform .45s var(--ease), background .45s ease, color .3s;
}
.bk-tab::before { content: ""; position: absolute; inset: 0 6px; border-left: 1px dashed rgba(247,228,164,.35); border-right: 1px dashed rgba(247,228,164,.35); pointer-events: none; }
.bk-tab svg { width: 22px; height: 22px; opacity: .9; }
.bk-tab:hover { transform: translateY(-9px); color: #fff; }
.bk-tab.is-active { transform: translateY(0); padding-bottom: 36px; color: #fff3d6; background: linear-gradient(180deg, #7a1f27, #9b2a33 70%, #6d1a22); }
.bk-tab.is-active::after { content: ""; position: absolute; left: 50%; bottom: 20px; width: 6px; height: 6px; background: var(--gold-hi); transform: translateX(-50%) rotate(45deg); box-shadow: 0 0 10px var(--gold); }

/* первая строка: название слева, «Архивариус» справа; вторая: [Новое существо] [поиск по центру, над «Оглавлением»] [Случайная встреча] */
.bk-title-mini { order: 1; }
.bk-appbar > #admin-toggle { order: 2; margin-left: auto; }
.bk-tools {
  order: 3; flex: 1 1 100%; display: grid; align-items: center; gap: 12px 20px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px) minmax(0, 1fr);
}
.bk-tools > #new-beast { grid-column: 1; grid-row: 1; justify-self: end; }
.bk-tools > .bk-search { grid-column: 2; grid-row: 1; width: auto; }
.bk-tools > #rand-btn { grid-column: 3; grid-row: 1; justify-self: start; }
@media (max-width: 1080px) {
  .bk-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
  .bk-tools > .bk-search { order: -1; flex: 1 1 100%; margin-inline: max(0px, calc((100% - 420px) / 2)); }
}
.bk-search {
  position: relative; display: flex; align-items: center; gap: 8px; width: min(300px, 100%);
  border-bottom: 1px solid rgba(217,180,92,.45); padding: 6px 4px; transition: border-color .3s, box-shadow .3s;
}
.bk-search:focus-within { border-bottom-color: var(--ac); box-shadow: 0 8px 18px -10px rgba(var(--ac-rgb), .7); }
.bk-search svg { width: 18px; height: 18px; color: var(--gold); flex: none; }
.bk-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--bone); font-family: var(--f-body); font-size: 17px; font-style: italic; padding: 2px 0; }
.bk-search input::placeholder { color: var(--bone-3); }
.bk-search input::-webkit-search-cancel-button { filter: invert(.8) sepia(1) saturate(2); cursor: pointer; }
.bk-search kbd { font-family: var(--f-mono); font-size: 11px; color: var(--bone-3); border: 1px solid rgba(217,180,92,.3); border-radius: 3px; padding: 0 6px; }
.bk-search:focus-within kbd { opacity: 0; }

/* предисловие */
.bk-fore { position: relative; max-width: 860px; margin: 0 auto 40px; text-align: center; }
.fore-quote { position: relative; margin: 0; padding: 4px 28px; font-family: var(--f-body); font-style: italic; color: var(--bone-2); font-size: 19px; line-height: 1.6; }
.fore-quote::before, .fore-quote::after { position: absolute; font-family: var(--f-title); font-size: 74px; line-height: 1; color: rgba(var(--ac-rgb), .5); transition: color .6s; }
.fore-quote::before { content: "«"; left: -6px; top: -14px; }
.fore-quote::after { content: "»"; right: -6px; bottom: -44px; }
.fq-line { display: block; margin: 5px 0; }
.fq-line b { font-family: var(--f-ui); font-style: normal; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--ac); margin-right: 8px; transition: color .6s; }
.fq-src { display: block; margin-top: 14px; font-family: var(--f-hand); font-style: normal; font-size: 18px; color: var(--bone-3); }
.fore-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .7s var(--ease), margin .7s var(--ease); margin-top: 0; }
.fore-more > .fore-text { overflow: hidden; min-height: 0; }
.bk-fore.is-open .fore-more { grid-template-rows: 1fr; margin-top: 34px; }
.fore-text { text-align: left; color: var(--bone-2); opacity: 0; transition: opacity .9s ease .1s; }
.bk-fore.is-open .fore-text { opacity: 1; }
.fore-text p { margin: 0 0 14px; }
.fore-toggle {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 30px; padding: 6px 4px; background: none; border: 0; cursor: pointer;
  font-family: var(--f-ui); font-weight: 700; font-size: 14px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold);
}
.fore-toggle svg { width: 16px; height: 16px; transition: transform .5s var(--ease); }
.bk-fore.is-open .fore-toggle svg { transform: rotate(90deg); }
.fore-toggle:hover { color: var(--gold-hi); }

/* фильтры */
.bk-filters { margin-bottom: 30px; }
.flt-sections { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 16px; }
.flt-chip {
  --c: var(--gold); --c-rgb: 217,180,92;
  position: relative; display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px 9px 11px; cursor: pointer;
  background: rgba(10,7,5,.6); border: 1px solid rgba(var(--c-rgb), .35); border-radius: 40px; color: var(--bone-2);
  font-family: var(--f-ui); font-weight: 700; font-size: 15px; letter-spacing: .1em; text-transform: uppercase;
  transition: all .35s var(--ease);
}
.flt-chip .ic { width: 28px; height: 28px; display: grid; place-items: center; color: var(--c); border: 1px solid rgba(var(--c-rgb), .5); border-radius: 50%; background: rgba(var(--c-rgb), .08); transition: all .35s; }
.flt-chip .ic svg { width: 16px; height: 16px; }
.flt-chip .n { font-family: var(--f-mono); font-weight: 500; font-size: 11px; letter-spacing: 0; color: var(--bone-3); }
.flt-chip:hover { border-color: var(--c); color: #fff; box-shadow: 0 0 22px rgba(var(--c-rgb), .25); transform: translateY(-2px); }
.flt-chip.is-active { color: #fff; border-color: var(--c); background: linear-gradient(160deg, rgba(var(--c-rgb), .26), rgba(var(--c-rgb), .08)); box-shadow: 0 0 30px rgba(var(--c-rgb), .28), inset 0 0 18px rgba(var(--c-rgb), .12); }
.flt-chip.is-active .ic { background: var(--c); color: #120a06; border-color: var(--c); box-shadow: 0 0 16px rgba(var(--c-rgb), .8); }
.flt-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; }
.flt-toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; cursor: pointer; background: transparent;
  border: 1px solid rgba(217,180,92,.3); border-radius: 2px; color: var(--bone-2);
  font-family: var(--f-ui); font-weight: 700; font-size: 14px; letter-spacing: .1em; text-transform: uppercase; transition: all .3s;
}
.flt-toggle svg { width: 16px; height: 16px; color: var(--gold); }
.flt-toggle:hover { border-color: var(--gold); color: #fff; }
.flt-toggle[aria-pressed="true"] { background: linear-gradient(160deg, #f7e4a4, #d9b45c); color: #1b1208; border-color: transparent; }
.flt-toggle[aria-pressed="true"] svg { color: #1b1208; }
.flt-select { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--bone-3); }
.flt-select select {
  appearance: none; -webkit-appearance: none; background: rgba(10,7,5,.8) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23d9b45c' stroke-width='1.4'/></svg>") no-repeat right 10px center;
  border: 1px solid rgba(217,180,92,.3); color: var(--bone); font-family: var(--f-body); font-size: 16px; padding: 6px 30px 6px 10px; border-radius: 2px; cursor: pointer; max-width: 230px;
}
.flt-select select:focus { outline: none; border-color: var(--ac); }
.flt-select select option { background: #120c08; color: var(--bone); }
.flt-count { font-family: var(--f-mono); font-size: 12px; color: var(--bone-3); letter-spacing: .04em; min-width: 90px; text-align: right; }

/* =========================================================
   ГАЛЕРЕЯ: гравюры
   ========================================================= */
.bk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 34px 26px; padding: 8px 0 20px; }
.plate { --c: var(--ac); --c-rgb: var(--ac-rgb); position: relative; perspective: 1000px; opacity: 0; transform: translateY(26px); animation: plateIn .8s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 38ms); }
@keyframes plateIn { to { opacity: 1; transform: none; } }
.plate-btn { display: block; width: 100%; padding: 0; background: none; border: 0; cursor: pointer; text-align: center; outline: none; }
.plate-frame {
  position: relative; aspect-ratio: 3 / 4; border-radius: 3px; overflow: hidden; isolation: isolate;
  background: #0a0705; border: 1px solid rgba(var(--c-rgb), .45);
  box-shadow: 0 18px 38px -14px rgba(0,0,0,.9), 0 0 0 4px #0b0705, 0 0 0 5px rgba(var(--c-rgb), .22);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  translate: 0 var(--ty, 0px);
  /* наклон, свет и ореол каждый кадр плавно считает bestiary-light.js, поэтому для них нет CSS-переходов (они дёргались) */
  transition: translate .7s var(--ease), border-color .4s;
  will-change: transform;
}
.plate-frame::before { content: ""; position: absolute; inset: 7px; z-index: 3; border: 1px solid rgba(var(--c-rgb), .5); pointer-events: none; transition: inset .5s var(--ease), border-color .4s; }
/* Свечения при наведении нет (убрано по просьбе). bestiary-light.js теперь отвечает только за плавный наклон карточки (--rx/--ry)
   и лёгкое смещение рисунка (--hx/--hy). */
.plate:hover .plate-frame, .plate-btn:focus-visible .plate-frame { --ty: -8px; border-color: var(--c); box-shadow: 0 30px 46px -16px rgba(0,0,0,.95), 0 0 0 4px #0b0705, 0 0 0 5px rgba(var(--c-rgb), .6); }
.plate:hover .plate-frame::before, .plate-btn:focus-visible .plate-frame::before { inset: 4px; border-color: var(--c); }
.plate-art { position: absolute; inset: 0; z-index: 1; }
.plate-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .6s ease, transform .9s var(--ease); }
.plate-art img.is-ready { opacity: 1; }
.plate:hover .plate-art img { transform: scale(1.06); }
.plate-art svg.sigil { width: 100%; height: 100%; }
/* глубина: рисунок плывёт против света, будто лежит под стеклом (смещение --hx/--hy ставит bestiary-light.js) */
.plate-art svg.sigil, .plate-art img { translate: calc(var(--hx, 0) * -6px) calc(var(--hy, 0) * -6px); scale: 1.04; }
.plate-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, transparent 28%, transparent 62%, rgba(0,0,0,.72) 100%); pointer-events: none; }
.pl-c { position: absolute; z-index: 5; width: 26px; height: 26px; color: var(--c); opacity: .85; pointer-events: none; filter: drop-shadow(0 0 4px rgba(var(--c-rgb), .6)); transition: transform .5s var(--ease); }
.pl-c.a { top: 3px; left: 3px; } .pl-c.b { top: 3px; right: 3px; transform: scaleX(-1); } .pl-c.c { bottom: 3px; left: 3px; transform: scaleY(-1); } .pl-c.d { bottom: 3px; right: 3px; transform: scale(-1); }
.plate:hover .pl-c.a { transform: translate(-2px,-2px); } .plate:hover .pl-c.b { transform: scaleX(-1) translate(-2px,-2px); }
.plate:hover .pl-c.c { transform: scaleY(-1) translate(-2px,-2px); } .plate:hover .pl-c.d { transform: scale(-1) translate(-2px,-2px); }
.pl-sec { position: absolute; z-index: 5; top: 14px; left: 14px; width: 26px; height: 26px; display: grid; place-items: center; color: var(--c); background: rgba(8,5,3,.72); border: 1px solid rgba(var(--c-rgb), .6); border-radius: 50%; box-shadow: 0 0 12px rgba(var(--c-rgb), .35); }
.pl-sec svg { width: 15px; height: 15px; }
.pl-flags { position: absolute; z-index: 5; right: 12px; top: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pl-flag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-hi); background: rgba(8,5,3,.78); border: 1px solid rgba(217,180,92,.45); }
.pl-flag svg { width: 12px; height: 12px; }
.pl-seen { position: absolute; z-index: 6; right: 10px; bottom: 10px; width: 34px; height: 34px; opacity: .92; filter: drop-shadow(0 2px 4px rgba(0,0,0,.7)); transform: rotate(-12deg); }
.plate-cap { padding: 16px 6px 0; }
.plate-cap h3 { margin: 0; font-family: var(--f-name); font-weight: 700; font-size: 20px; line-height: 1.15; letter-spacing: .02em; color: var(--bone); transition: color .3s; }
.plate:hover .plate-cap h3 { color: var(--gold-hi); }
.plate-cap .en { margin: 3px 0 0; font-style: italic; font-size: 15px; color: var(--c); opacity: .9; }
.plate-cap .sub { margin: 7px 0 0; font-size: 15px; line-height: 1.4; color: var(--bone-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plate-admin { position: absolute; z-index: 8; top: 44px; left: 14px; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; cursor: pointer; color: #1b1208; background: linear-gradient(160deg, #f7e4a4, #d9b45c); border: 0; border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,.6); }
.plate-admin svg { width: 16px; height: 16px; }
.plate-admin.has { background: linear-gradient(160deg, #bff0c8, #5fb87a); }
.bk-empty { text-align: center; padding: 70px 20px; color: var(--bone-3); }
.bk-empty svg { width: 54px; height: 54px; margin: 0 auto 16px; color: var(--gold-lo); opacity: .8; }
.bk-empty p { margin: 0 0 18px; font-style: italic; font-size: 19px; }

/* =========================================================
   ОГЛАВЛЕНИЕ
   ========================================================= */
.idx-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 46px; align-items: start; }
.idx-sec { margin-bottom: 34px; --c: var(--ac); --c-rgb: var(--ac-rgb); }
.idx-sec h2 { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; font-family: var(--f-title); font-weight: 400; font-size: 30px; letter-spacing: .06em; text-transform: uppercase; color: var(--c); }
.idx-sec h2 svg { width: 28px; height: 28px; filter: drop-shadow(0 0 8px rgba(var(--c-rgb), .6)); }
.idx-sec h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(var(--c-rgb), .55), transparent); }
.idx-line { display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 6px 10px; background: none; border: 0; border-radius: 2px; cursor: pointer; text-align: left; color: var(--bone-2); font-family: var(--f-body); font-size: 19px; transition: background .25s, color .25s, padding .3s var(--ease); }
.idx-line .lead { flex: 1; min-width: 24px; border-bottom: 1px dotted rgba(217,180,92,.3); transform: translateY(-5px); }
.idx-line .en { font-style: italic; font-size: 15px; color: var(--bone-3); }
.idx-line .mk { display: inline-flex; gap: 5px; color: var(--gold); }
.idx-line .mk svg { width: 14px; height: 14px; }
.idx-line:hover, .idx-line.is-hot { background: linear-gradient(90deg, rgba(var(--c-rgb), .16), transparent); color: #fff; padding-left: 18px; }
.idx-line.child { padding-left: 34px; font-size: 17px; color: var(--bone-3); }
.idx-line.child:hover, .idx-line.child.is-hot { padding-left: 42px; }
.idx-line.child .nm::before { content: "└ "; color: rgba(217,180,92,.5); }
.idx-line.is-seen .nm::after { content: " ✓"; color: var(--c); font-size: 14px; }
.idx-preview { position: sticky; top: 104px; }
.idx-card { --c: var(--ac); --c-rgb: var(--ac-rgb); }
.idx-card .plate-frame { transform: none; }
.idx-card h3 { margin: 16px 0 0; font-family: var(--f-name); font-weight: 700; font-size: 24px; color: var(--gold-hi); }
.idx-card .en { margin: 2px 0 0; font-style: italic; color: var(--c); }
.idx-card p { margin: 10px 0 0; color: var(--bone-2); font-size: 16px; line-height: 1.5; }
.idx-card.fade { animation: idxFade .35s ease; }
@keyframes idxFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =========================================================
   ЖУРНАЛ ИССЛЕДОВАТЕЛЯ
   ========================================================= */
.jr-head { display: flex; align-items: center; justify-content: center; gap: 36px; flex-wrap: wrap; margin: 6px 0 36px; text-align: left; }
.jr-ring { position: relative; width: 150px; height: 150px; flex: none; }
.jr-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.jr-ring .bg { fill: none; stroke: rgba(217,180,92,.16); stroke-width: 6; }
.jr-ring .fg { fill: none; stroke: url(#jr-grad); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.6s var(--ease); filter: drop-shadow(0 0 8px rgba(217,180,92,.6)); }
.jr-ring .mid { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.jr-ring .mid b { display: block; font-family: var(--f-title); font-size: 34px; font-weight: 400; color: var(--gold-hi); line-height: 1; }
.jr-ring .mid small { display: block; font-family: var(--f-mono); font-size: 11px; color: var(--bone-3); margin-top: 4px; }
.jr-rank p { margin: 0; }
.jr-rank .lbl { font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--bone-3); }
.jr-rank .nm { font-family: var(--f-title); font-size: clamp(28px, 5vw, 42px); color: var(--gold-hi); line-height: 1.1; text-shadow: 0 0 22px rgba(217,180,92,.35); }
.jr-rank .nx { margin-top: 6px; font-style: italic; color: var(--bone-2); }
.jr-secs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 40px; }
.jr-sec { --c: var(--ac); --c-rgb: var(--ac-rgb); padding: 16px 18px; border: 1px solid rgba(var(--c-rgb), .4); background: linear-gradient(160deg, rgba(var(--c-rgb), .1), rgba(10,7,5,.8)); border-radius: 3px; }
.jr-sec .t { display: flex; align-items: center; gap: 10px; font-family: var(--f-ui); font-weight: 700; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--c); }
.jr-sec .t svg { width: 20px; height: 20px; }
.jr-sec .bar { height: 5px; margin: 12px 0 8px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; }
.jr-sec .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, rgba(var(--c-rgb), .5), var(--c)); box-shadow: 0 0 10px var(--c); border-radius: 3px; transition: width 1.4s var(--ease); }
.jr-sec .nn { font-family: var(--f-mono); font-size: 12px; color: var(--bone-3); }
.jr-h { display: flex; align-items: center; gap: 16px; margin: 0 0 18px; font-family: var(--f-ui); font-weight: 700; font-size: 17px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.jr-h::before, .jr-h::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(217,180,92,.4)); }
.jr-h::after { background: linear-gradient(270deg, transparent, rgba(217,180,92,.4)); }
.jr-seals { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 16px 12px; }
.jr-seal { --c: var(--ac); --c-rgb: var(--ac-rgb); display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0; background: none; border: 0; cursor: pointer; }
.jr-seal .w { position: relative; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; transition: transform .4s var(--ease), filter .4s; }
.jr-seal.on .w { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 40%), radial-gradient(circle, var(--c), rgba(var(--c-rgb), .5) 80%); box-shadow: inset 0 0 0 4px rgba(0,0,0,.18), inset 0 0 0 5px rgba(255,255,255,.18), 0 6px 16px rgba(0,0,0,.6); }
.jr-seal.on .w svg { width: 32px; height: 32px; color: rgba(20,8,2,.8); }
.jr-seal.off .w { border: 1px dashed rgba(217,180,92,.3); color: rgba(217,180,92,.3); font-family: var(--f-title); font-size: 22px; background: rgba(255,255,255,.015); }
.jr-seal:hover .w { transform: scale(1.1) rotate(-6deg); }
.jr-seal span.nm { font-size: 13.5px; line-height: 1.2; color: var(--bone-2); text-align: center; }
.jr-seal.off span.nm { color: var(--bone-3); filter: blur(3.5px); transition: filter .3s; }
.jr-seal.off:hover span.nm { filter: blur(0); }
.jr-foot { margin-top: 34px; text-align: center; }

/* =========================================================
   ЗАМЕТКИ НА ПОЛЯХ и источник
   ========================================================= */
.bk-margin { max-width: 880px; margin: 70px auto 0; padding: 28px 32px; border: 1px dashed rgba(217,180,92,.3); border-radius: 3px; background: rgba(10,7,5,.55); }
.bk-margin h3 { margin: 0 0 12px; font-family: var(--f-hand); font-weight: 400; font-size: 28px; color: var(--ac); transition: color .6s; }
.bk-margin ul { margin: 0 0 18px; padding-left: 20px; color: var(--bone-2); }
.bk-margin li { margin: 6px 0; }
.bk-margin .see { color: var(--bone-3); font-style: italic; margin: 0; }
.bk-margin .see b { font-style: normal; font-family: var(--f-ui); letter-spacing: .14em; text-transform: uppercase; font-size: 13px; color: var(--gold); margin-right: 8px; }
.bk-credit { max-width: 760px; margin: 36px auto 0; text-align: center; font-size: 14px; line-height: 1.55; color: var(--bone-3); }
.bk-credit a { color: var(--gold); border-bottom: 1px dotted rgba(217,180,92,.5); }
sup.bkref { font-family: var(--f-mono); font-size: .62em; line-height: 0; vertical-align: super; color: var(--ac); cursor: help; padding: 0 1px; }
sup.bkref:hover { color: var(--gold-hi); text-decoration: underline; }

/* =========================================================
   РАЗВОРОТ СУЩЕСТВА
   ========================================================= */
.bk-folio { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.fo-back { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 38%, rgba(var(--ac-rgb), .10), rgba(2,1,1,.9) 72%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: foBack .5s ease both; }
@keyframes foBack { from { opacity: 0; } to { opacity: 1; } }
.fo-book {
  position: relative; width: min(1200px, 100%); height: min(88vh, 840px); display: flex; flex-direction: column;
  background: #0b0705; border-radius: 6px;
  box-shadow: 0 40px 120px rgba(0,0,0,.9), 0 0 0 1px rgba(217,180,92,.4), 0 0 0 7px #090604, 0 0 0 8px rgba(217,180,92,.2), 0 0 90px rgba(var(--ac-rgb), .12);
  animation: foOpen .75s var(--ease) both; transform-origin: 50% 60%;
}
@keyframes foOpen { from { opacity: 0; transform: perspective(1800px) rotateX(14deg) translateY(40px) scale(.94); } to { opacity: 1; transform: none; } }
.bk-folio.is-closing .fo-book { animation: foClose .35s ease-in both; }
.bk-folio.is-closing .fo-back { animation: foBack .35s ease reverse both; }
@keyframes foClose { to { opacity: 0; transform: perspective(1800px) rotateX(10deg) translateY(30px) scale(.95); } }
.fo-close { position: absolute; z-index: 20; top: 14px; right: 14px; width: 40px; height: 40px; padding: 0; cursor: pointer; background: rgba(8,5,3,.8); border: 1px solid rgba(217,180,92,.4); border-radius: 50%; transition: all .3s var(--ease); }
.fo-close span { position: absolute; left: 11px; right: 11px; top: 19px; height: 1.5px; background: var(--gold-hi); }
.fo-close span:first-child { transform: rotate(45deg); } .fo-close span:last-child { transform: rotate(-45deg); }
.fo-close:hover { transform: rotate(90deg); border-color: var(--gold); box-shadow: 0 0 20px rgba(217,180,92,.4); }

.fo-spread { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 5fr 6fr; }
.fo-spread::before { content: ""; position: absolute; z-index: 6; left: calc(5 / 11 * 100%); top: 0; bottom: 0; width: 56px; transform: translateX(-50%); pointer-events: none; background: linear-gradient(90deg, transparent, rgba(0,0,0,.6) 46%, rgba(0,0,0,.78) 50%, rgba(0,0,0,.6) 54%, transparent); }
.fo-left {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 32px 30px 18px 36px; overflow-y: auto; overflow-x: hidden; border-radius: 6px 0 0 0;
  background: radial-gradient(ellipse at 50% 28%, rgba(var(--ac-rgb), .13), transparent 68%), linear-gradient(90deg, #0d0907, #140d09 94%, #0a0705);
}
.fo-right { position: relative; min-height: 0; border-radius: 0 6px 0 0; background: linear-gradient(270deg, #0d0907, #150f0a 94%, #0a0705); perspective: 1800px; }
.fo-scroll { height: 100%; overflow-y: auto; padding: 38px 46px 30px 42px; transform-origin: left center; scrollbar-width: thin; scrollbar-color: rgba(217,180,92,.4) transparent; }
.fo-right.turn-out .fo-scroll { animation: leafOut .26s ease-in forwards; }
.fo-right.turn-in .fo-scroll { animation: leafIn .55s var(--ease) both; }
@keyframes leafOut { to { transform: rotateY(-78deg); opacity: 0; filter: brightness(.6); } }
@keyframes leafIn { from { transform: rotateY(60deg); opacity: 0; filter: brightness(.7); } to { transform: none; opacity: 1; filter: none; } }

.fo-plate { --c: var(--ac); --c-rgb: var(--ac-rgb); perspective: 1000px; position: relative; width: min(100%, clamp(190px, 34vh, 330px)); flex: none; }
/* на развороте свет живёт сам по себе (блуждает и мерцает), а при наведении идёт за курсором */
.fo-plate .plate-frame { box-shadow: 0 24px 50px -14px rgba(0,0,0,.95), 0 0 0 5px #0a0604, 0 0 0 6px rgba(var(--c-rgb), .6); }
.fo-plate .plate-art img { transition: opacity .8s ease; }
.fo-plate .plate-frame .sigil .sg-rot { animation-play-state: running; }
.fo-meta { width: 100%; max-width: 330px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.fo-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.fo-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 12px; font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--c, var(--gold)); border: 1px solid rgba(var(--c-rgb, 217,180,92), .5); background: rgba(var(--c-rgb, 217,180,92), .08); }
.fo-tag svg { width: 14px; height: 14px; }
.fo-tag.gold { --c: var(--gold-hi); --c-rgb: 217,180,92; }
.fo-crumb { font-size: 15px; color: var(--bone-3); font-style: italic; }
.fo-crumb button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--gold); border-bottom: 1px dotted rgba(217,180,92,.5); font: inherit; }
.fo-kids { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.fo-kids h4 { margin: 0 0 4px; font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--bone-3); }
.fo-kid { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; width: 100%; text-align: left; cursor: pointer; background: rgba(255,255,255,.02); border: 1px solid rgba(217,180,92,.2); border-radius: 3px; color: var(--bone-2); font-size: 16px; transition: all .3s var(--ease); }
.fo-kid .mini { width: 34px; height: 44px; flex: none; border: 1px solid rgba(var(--c-rgb), .5); overflow: hidden; border-radius: 2px; background: #0a0705; }
.fo-kid .mini svg, .fo-kid .mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fo-kid:hover { border-color: var(--c); background: rgba(var(--c-rgb), .12); color: #fff; transform: translateX(3px); }
.fo-admin { width: 100%; max-width: 330px; padding: 12px; border: 1px dashed rgba(217,180,92,.4); border-radius: 3px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; background: rgba(217,180,92,.04); }
.fo-admin .bk-btn { padding: 7px 12px; font-size: 13px; }
.fo-admin small { width: 100%; text-align: center; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-lo); }

.fo-sec-label { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-family: var(--f-ui); font-weight: 700; font-size: 14px; letter-spacing: .24em; text-transform: uppercase; color: var(--c); }
.fo-sec-label svg { width: 18px; height: 18px; }
.fo-sec-label span { color: var(--bone-3); }
.fo-title { margin: 0; font-family: var(--f-name); font-weight: 800; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.05; letter-spacing: .01em; padding-right: 36px;
  background: linear-gradient(100deg, #f7e4a4, #d9b45c 40%, #fff3c4 55%, #c9972f 80%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: foil 7s linear infinite; }
.fo-en { margin: 6px 0 0; font-style: italic; font-size: 20px; color: var(--c); }
.fo-alt { margin: 4px 0 0; font-family: var(--f-hand); font-size: 20px; color: var(--bone-3); }
.fo-div { width: 200px; height: 16px; margin: 18px 0 20px; color: var(--c); opacity: .85; }
.fo-body p { margin: 0 0 16px; color: var(--bone); font-size: 19px; line-height: 1.7; opacity: 0; animation: inkIn .9s var(--ease) forwards; animation-delay: calc(var(--d, 0) * 110ms + 150ms); }
@keyframes inkIn { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.fo-list { margin: 0 0 18px; padding: 0; list-style: none; opacity: 0; animation: inkIn .9s var(--ease) forwards; animation-delay: calc(var(--d, 0) * 110ms + 150ms); }
.fo-list li { position: relative; padding: 4px 0 4px 26px; color: var(--bone); font-size: 18px; line-height: 1.55; }
.fo-list li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 8px; height: 8px; border: 1px solid var(--c); transform: rotate(45deg); background: rgba(var(--c-rgb), .4); }
.fo-note { margin: 4px 0 18px; padding: 12px 16px; border-left: 2px solid var(--c); background: rgba(var(--c-rgb), .06); color: var(--bone-2); font-size: 16px; font-style: italic; }
.fo-note b { font-style: normal; font-family: var(--f-ui); letter-spacing: .14em; text-transform: uppercase; font-size: 12.5px; color: var(--c); margin-right: 6px; }
.fo-h { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; font-family: var(--f-ui); font-weight: 700; font-size: 15px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.fo-h::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(217,180,92,.4), transparent); }
.ing-grid { display: grid; gap: 10px; }
.ing { --pc: #c9a96a; position: relative; display: grid; grid-template-columns: 8px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px 12px 0; border: 1px solid rgba(217,180,92,.18); border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--pc) 14%, transparent), rgba(255,255,255,.02) 60%); color: var(--bone); transition: all .35s var(--ease); overflow: hidden; }
.ing::before { content: ""; align-self: stretch; background: var(--pc); box-shadow: 0 0 14px var(--pc); }
.ing .tt { display: block; font-family: var(--f-name); font-weight: 700; font-size: 18px; line-height: 1.2; }
.ing .tt em { font-weight: 500; font-style: italic; color: var(--bone-3); font-size: 15px; margin-left: 4px; }
.ing .dd { display: block; margin-top: 3px; color: var(--bone-2); font-size: 16px; line-height: 1.35; }
.ing .dd i { color: var(--pc); font-style: normal; font-family: var(--f-ui); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 12.5px; }
.ing .go { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--pc); white-space: nowrap; }
.ing .go svg { width: 15px; height: 15px; }
a.ing:hover { transform: translateX(4px); border-color: var(--pc); box-shadow: 0 0 26px color-mix(in srgb, var(--pc) 30%, transparent); }
.ing.nolink .go { display: none; }
.fo-sub-list { display: grid; gap: 8px; }
.fo-sub { display: block; width: 100%; padding: 10px 14px; text-align: left; cursor: pointer; background: rgba(255,255,255,.02); border: 1px solid rgba(217,180,92,.18); border-radius: 3px; color: var(--bone); transition: all .3s var(--ease); }
.fo-sub b { font-family: var(--f-name); font-size: 18px; } .fo-sub span { display: block; font-size: 15px; color: var(--bone-3); }
.fo-sub:hover { border-color: var(--c); background: rgba(var(--c-rgb), .1); transform: translateX(4px); }
.fo-src { margin-top: 20px; }
.fo-src summary { cursor: pointer; font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--bone-3); list-style: none; }
.fo-src summary::-webkit-details-marker { display: none; }
.fo-src summary::before { content: "▸ "; color: var(--gold); }
.fo-src[open] summary::before { content: "▾ "; }
.fo-src ol { margin: 10px 0 0; padding: 0; list-style: none; font-size: 15px; color: var(--bone-3); }
.fo-src li { padding: 3px 0; } .fo-src li b { font-family: var(--f-mono); font-weight: 500; color: var(--ac); margin-right: 8px; }
.fo-src li.flash { background: rgba(var(--ac-rgb), .2); transition: background 1.6s; }
.seal-new { position: absolute; z-index: 9; right: -14px; bottom: -14px; width: 78px; height: 78px; pointer-events: none; animation: stamp .9s cubic-bezier(.2,1.5,.4,1) both; filter: drop-shadow(0 6px 10px rgba(0,0,0,.7)); }
@keyframes stamp { 0% { opacity: 0; transform: scale(2.4) rotate(-40deg); } 55% { opacity: 1; transform: scale(.9) rotate(-14deg); } 75% { transform: scale(1.06) rotate(-10deg); } 100% { opacity: 1; transform: scale(1) rotate(-12deg); } }
.fo-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; border-top: 1px solid rgba(217,180,92,.22); background: rgba(6,4,3,.7); border-radius: 0 0 6px 6px; }
.fo-arrow { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; cursor: pointer; background: none; border: 1px solid rgba(217,180,92,.3); border-radius: 2px; font-family: var(--f-ui); font-weight: 700; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-hi); transition: all .3s; }
.fo-arrow svg { width: 16px; height: 16px; }
.fo-arrow:hover:not(:disabled) { border-color: var(--gold); background: rgba(217,180,92,.1); box-shadow: 0 0 18px rgba(217,180,92,.2); }
.fo-arrow:disabled { opacity: .3; cursor: default; }
.fo-count { font-family: var(--f-mono); font-size: 12px; color: var(--bone-3); letter-spacing: .06em; }
body.fo-lock { overflow: hidden; }

/* =========================================================
   ОБРЯД СЛУЧАЙНОЙ ВСТРЕЧИ
   ========================================================= */
.bk-ritual { position: fixed; inset: 0; z-index: 400; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: radial-gradient(ellipse at 50% 50%, rgba(var(--ac-rgb), .14), rgba(0,0,0,.94) 62%); cursor: pointer; animation: foBack .35s ease both; }
.rit-svg { width: min(78vmin, 520px); height: min(78vmin, 520px); overflow: visible; }
.rit-svg .r { fill: none; stroke: var(--ac); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 8px var(--ac)); }
.rit-svg .r.thin { stroke-width: 1; opacity: .8; }
.rit-svg .fill { fill: var(--ac); opacity: 0; filter: drop-shadow(0 0 14px var(--ac)); }
.bk-ritual.go .rit-svg .r { animation: draw 1.5s var(--ease) forwards; animation-delay: calc(var(--d, 0) * 1ms); }
.bk-ritual.go .rit-svg .spin { transform-origin: 200px 200px; animation: spin 7s linear infinite; }
.bk-ritual.go .rit-svg .spin2 { transform-origin: 200px 200px; animation: spin 11s linear infinite reverse; }
.bk-ritual.go .rit-svg .fill { animation: flash 1.4s ease-out 1.1s forwards; }
.bk-ritual.flash { animation: ritFlash .6s ease-out forwards; }
@keyframes flash { 0% { opacity: 0; transform: scale(.4); transform-origin: 200px 200px; } 40% { opacity: .95; } 100% { opacity: 0; transform: scale(2.4); transform-origin: 200px 200px; } }
@keyframes ritFlash { to { background: #fff3d6; opacity: 0; } }
.rit-text { margin: 0; font-family: var(--f-hand); font-size: clamp(22px, 4vw, 32px); color: var(--bone); text-shadow: 0 0 20px rgba(var(--ac-rgb), .8); opacity: 0; animation: inkIn 1s ease .5s forwards; text-align: center; padding: 0 20px; }

/* =========================================================
   ОКНО ЗАГРУЗКИ КАРТИНКИ (главный админ)
   ========================================================= */
.bk-crop { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(2,1,1,.9); backdrop-filter: blur(5px); animation: foBack .3s ease both; }
.cr-box { width: min(440px, 100%); max-height: 96vh; overflow-y: auto; padding: 24px 26px 22px; text-align: center; background: linear-gradient(160deg, #150e0a, #0b0705); border: 1px solid rgba(217,180,92,.4); border-radius: 4px; box-shadow: 0 30px 90px rgba(0,0,0,.9); }
.cr-box h3 { margin: 0; font-family: var(--f-title); font-weight: 400; font-size: 26px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-hi); }
.cr-name { margin: 4px 0 14px; font-style: italic; color: var(--bone-2); }
.cr-stage { position: relative; width: 300px; height: 400px; max-width: 100%; margin: 0 auto 12px; background: #050302; border: 1px solid rgba(217,180,92,.35); cursor: grab; touch-action: none; overflow: hidden; }
.cr-stage.drag { cursor: grabbing; }
.cr-stage canvas { display: block; width: 100%; height: 100%; }
.cr-frame { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 2px rgba(217,180,92,.5); background: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px) 0 33.3%/100% 33.3% repeat-y, linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px) 33.3% 0/33.3% 100% repeat-x; opacity: .6; }
.cr-drop { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 20px; color: var(--bone-3); font-style: italic; pointer-events: none; }
.cr-stage.has .cr-drop { display: none; }
.cr-stage.over { border-color: var(--gold-hi); box-shadow: 0 0 30px rgba(217,180,92,.4); }
.cr-zoom { display: flex; align-items: center; gap: 14px; justify-content: center; font-family: var(--f-ui); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; color: var(--bone-3); }
.cr-zoom input { width: 190px; accent-color: #d9b45c; }
.cr-hint { margin: 10px 0 14px; font-size: 14px; color: var(--bone-3); }
.cr-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cr-msg { min-height: 1.4em; margin: 12px 0 0; font-size: 15px; color: var(--bone-2); }
.cr-msg.err { color: #f0907a; } .cr-msg.ok { color: #9fe0a8; }

/* =========================================================
   АДАПТАЦИЯ
   ========================================================= */
@media (max-width: 980px) {
  .bk-wrap { padding: 0 18px 80px; }
  .bk-appbar { flex-direction: column; align-items: stretch; padding-top: 22px; }
  .bk-title-mini { justify-content: center; }
  .bk-tabs { position: relative; left: auto; top: auto; transform: none; order: 4; justify-content: center; margin: 4px 0 -22px; gap: 6px; }
  .bk-appbar > #admin-toggle { margin: 0 auto; }
  .bk-tab { min-width: 74px; padding: 12px 10px 28px; font-size: 12px; letter-spacing: .08em; }
  .bk-tools { justify-content: center; }
  .bk-appbar { margin-bottom: 40px; }
  .idx-layout { grid-template-columns: 1fr; }
  .idx-preview { display: none; }
  .fo-spread { grid-template-columns: 1fr; overflow-y: auto; }
  .fo-spread::before { display: none; }
  .fo-left { padding: 26px 20px 10px; overflow: visible; border-radius: 6px 6px 0 0; }
  .fo-plate { width: min(240px, 66%); }
  .fo-right { overflow: visible; }
  .fo-scroll { overflow: visible; height: auto; padding: 18px 22px 24px; }
  .fo-book { height: min(94vh, 900px); }
  .fo-title { padding-right: 0; }
}
@media (max-width: 600px) {
  .bk-page { font-size: 17px; }
  .bk-grid { grid-template-columns: repeat(2, 1fr); gap: 24px 14px; }
  .plate-cap h3 { font-size: 17px; }
  .plate-cap .sub { display: none; }
  .flt-count { width: 100%; text-align: center; }
  .btn-label-long { display: none; }
  .fore-quote { font-size: 17px; padding: 4px 18px; }
  .ing { grid-template-columns: 6px 1fr; } .ing .go { display: none; }
  .bk-tab { min-width: 66px; padding: 12px 4px 28px; gap: 5px; } .bk-tab span { font-size: 9.5px; letter-spacing: .02em; }
}
@media (prefers-reduced-motion: reduce) {
  .bk-shade::before, .cover-glow, .tome, .tc-title, .fo-title, .plate-frame, .fo-plate .plate-frame, .bk-btn-ember,  .sg-rot { animation: none !important; }
  .plate { opacity: 1 !important; transform: none !important; animation: none !important; }
  .fo-body p, .fo-list { opacity: 1 !important; animation: none !important; }
}

/* --- печати-гравюры и эмблема --- */
.sigil .sg-rot { transform-origin: 150px 200px; animation: spin 90s linear infinite; animation-play-state: paused; }
.sigil .sg-rot.rev { animation-direction: reverse; animation-duration: 140s; }
.plate:hover .sigil .sg-rot, .fo-plate .sigil .sg-rot, .idx-card .sigil .sg-rot, .tome:hover ~ * .sigil .sg-rot { animation-play-state: running; }
.sigil .sg-pulse { animation: sgPulse 4.5s ease-in-out infinite; }
@keyframes sgPulse { 0%,100% { opacity: .72; } 50% { opacity: 1; } }
.em-d { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 3.4s var(--ease) .35s forwards; }
.em-spin { transform-origin: 150px 150px; animation: spin 140s linear infinite; }
.em-spin.rev { animation-direction: reverse; animation-duration: 190s; }
.em-eye { transform-origin: 150px 150px; animation: eyePulse 4.5s ease-in-out infinite; }
@keyframes eyePulse { 0%,100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }

.ing .tx { min-width: 0; }

sup.bkref + sup.bkref::before { content: ","; margin-right: 1px; color: var(--bone-3); }

/* общие анимации линий и вращения */
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.fo-sec-label { flex-wrap: wrap; }
.fo-share { margin-left: auto; margin-right: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; cursor: pointer; background: none; border: 1px solid rgba(217,180,92,.28); border-radius: 2px; color: var(--bone-3); font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; transition: all .3s; }
.fo-share svg { width: 13px; height: 13px; } .fo-share i { font-style: normal; }
.fo-share:hover { color: var(--gold-hi); border-color: var(--gold); }
.fo-count { white-space: nowrap; }
@media (max-width: 980px) { .fo-share { margin-right: 0; } }

/* главы книги в галерее */
.bk-chapter { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; margin: 30px 0 4px; padding-bottom: 14px; border-bottom: 1px solid rgba(var(--c-rgb), .35); position: relative; opacity: 0; transform: translateY(18px); animation: plateIn .9s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 38ms); }
.bk-chapter::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 120px; background: var(--c); box-shadow: 0 0 12px var(--c); }
.bk-chapter:first-child { margin-top: 6px; }
.ch-ic { flex: none; width: 54px; height: 54px; display: grid; place-items: center; color: var(--c); border: 1px solid rgba(var(--c-rgb), .55); border-radius: 50%; background: radial-gradient(circle, rgba(var(--c-rgb), .18), transparent 70%); box-shadow: 0 0 26px rgba(var(--c-rgb), .3); }
.ch-ic svg { width: 28px; height: 28px; }
.ch-tx { flex: 1; min-width: 0; }
.ch-tx h2 { margin: 0; font-family: var(--f-title); font-weight: 400; font-size: clamp(24px, 3.6vw, 34px); letter-spacing: .06em; text-transform: uppercase; color: var(--c); text-shadow: 0 0 24px rgba(var(--c-rgb), .35); }
.ch-tx p { margin: 4px 0 0; color: var(--bone-3); font-style: italic; font-size: 16px; max-width: 70ch; }
.ch-n { flex: none; font-family: var(--f-mono); font-size: 13px; color: var(--c); border: 1px solid rgba(var(--c-rgb), .5); border-radius: 12px; padding: 1px 10px; }
@media (max-width: 600px) { .ch-ic { width: 42px; height: 42px; } .ch-ic svg { width: 22px; height: 22px; } .ch-tx p { display: none; } }

/* родственные записи по Путям */
.rel { --pc: #c9a96a; margin-bottom: 14px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--pc) 30%, transparent); border-left: 3px solid var(--pc); border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--pc) 9%, transparent), transparent 70%); }
.rel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rel-h > span { font-family: var(--f-name); font-weight: 700; font-size: 17px; color: var(--pc); }
.rel-all { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px; cursor: pointer; background: none; border: 0; color: var(--bone-2); font-family: var(--f-ui); font-weight: 700; font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; border-bottom: 1px dotted rgba(217,180,92,.5); }
.rel-all svg { width: 13px; height: 13px; } .rel-all:hover { color: var(--gold-hi); }
.rel-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rel-chip { padding: 4px 12px; cursor: pointer; background: rgba(255,255,255,.03); color: var(--bone); border: 1px solid rgba(217,180,92,.25); border-radius: 14px; font-size: 16px; transition: all .3s var(--ease); }
.rel-chip:hover { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, transparent); color: #fff; transform: translateY(-2px); }
.rel-more { align-self: center; color: var(--bone-3); font-style: italic; font-size: 15px; }

/* =========================================================
   РЕДАКТОР БЕСТИАРИЯ (главный админ и Повелители тайн) — bestiary-staff.js
   ========================================================= */
.pl-flag.is-new { padding: 2px 6px; color: #9fe0b0; border-color: rgba(159,224,176,.5); }
.fo-staff { border-color: rgba(var(--c-rgb), .5); background: rgba(var(--c-rgb), .05); }
.fo-staff small { color: var(--c); }
.bk-btn.is-danger { color: #e08a8a; border-color: rgba(224,138,138,.45); }
.bk-btn.is-danger:hover { background: rgba(224,138,138,.12); border-color: #e08a8a; }

/* характеристики на развороте существа */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); gap: 8px 20px; margin: 0 0 6px; }
.stat { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 12px; background: rgba(var(--c-rgb), .05); border: 1px solid rgba(var(--c-rgb), .2); border-left: 3px solid var(--c); border-radius: 2px; }
.sk { flex: 1 1 auto; font-family: var(--f-ui); font-weight: 700; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--bone-3); }
.sv { font-size: 17px; color: var(--bone); text-align: right; overflow-wrap: anywhere; }
.sv.num { font-family: var(--f-mono); font-size: 16px; color: var(--gold-hi); }
.sv.pips { display: inline-flex; align-items: center; gap: 4px; flex: none; white-space: nowrap; }
.sv.pips i { width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid rgba(var(--c-rgb), .6); background: transparent; transition: background .3s ease, box-shadow .3s ease; }
.sv.pips i.on { background: var(--c); box-shadow: 0 0 6px rgba(var(--c-rgb), .6); }
.sv.pips em { margin-left: 8px; white-space: nowrap; font-style: normal; font-family: var(--f-mono); font-size: 14px; color: var(--gold-hi); }
.sv.pips em small { font-size: 11px; color: var(--bone-3); }

/* окно редактора */
body.ed-lock { overflow: hidden; }
.bk-edit { position: fixed; inset: 0; z-index: 520; display: flex; align-items: center; justify-content: center; padding: 18px; }
.bk-edit[hidden] { display: none; }
.ed-back { position: absolute; inset: 0; background: rgba(2,1,1,.88); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: foBack .3s ease both; }
.ed-box { position: relative; width: min(800px, 100%); max-height: 94vh; display: flex; flex-direction: column; background: linear-gradient(160deg, #170f0a, #0b0705); border: 1px solid rgba(217,180,92,.4); border-radius: 4px; box-shadow: 0 30px 90px rgba(0,0,0,.9); animation: foOpen .45s var(--ease) both; }
.ed-x { position: absolute; top: 14px; right: 14px; z-index: 2; width: 36px; height: 36px; cursor: pointer; background: none; border: 1px solid rgba(217,180,92,.3); border-radius: 50%; transition: border-color .25s ease, background .25s ease; }
.ed-x:hover { border-color: var(--gold); background: rgba(217,180,92,.1); }
.ed-x span { position: absolute; left: 9px; right: 9px; top: 50%; height: 1.5px; background: var(--bone); }
.ed-x span:first-child { transform: rotate(45deg); } .ed-x span:last-child { transform: rotate(-45deg); }
.ed-head { padding: 24px 64px 14px 28px; border-bottom: 1px solid rgba(217,180,92,.2); }
.ed-head h3 { margin: 0; font-family: var(--f-title); font-weight: 400; font-size: 26px; letter-spacing: .05em; text-transform: uppercase; color: var(--gold-hi); }
.ed-sub { margin: 4px 0 0; font-style: italic; font-size: 16px; color: var(--bone-3); }
.ed-body { flex: 1; overflow-y: auto; padding: 18px 28px 6px; scrollbar-width: thin; scrollbar-color: rgba(217,180,92,.4) transparent; }
.ed-sec { padding-bottom: 10px; }
.ed-sec + .ed-sec { margin-top: 12px; padding-top: 16px; border-top: 1px dashed rgba(217,180,92,.25); }
.ed-sec[hidden] { display: none; }
.ed-sec[hidden] + .ed-sec { margin-top: 0; padding-top: 0; border-top: 0; }
.ed-top { display: grid; grid-template-columns: 112px 1fr; gap: 20px; align-items: start; }
.ed-prev { --c: var(--gold); --c-rgb: 217,180,92; width: 112px; height: 150px; margin-top: 4px; overflow: hidden; background: #0a0705; border: 1px solid rgba(var(--c-rgb), .55); border-radius: 3px; box-shadow: 0 8px 22px rgba(0,0,0,.6), 0 0 0 3px #0b0705, 0 0 0 4px rgba(var(--c-rgb), .3); }
.ed-prev svg { display: block; width: 100%; height: 100%; }
.ed-l { display: block; margin: 14px 0 6px; font-family: var(--f-ui); font-weight: 700; font-size: 14px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.ed-l i { font-style: italic; font-weight: 400; letter-spacing: .04em; text-transform: none; color: var(--bone-3); font-family: var(--f-body); font-size: 14px; }
.ed-top-f .ed-l:first-child { margin-top: 0; }
.bk-edit input[type="text"], .bk-edit select, .bk-edit textarea {
  width: 100%; padding: 9px 12px; color: var(--bone); background: rgba(0,0,0,.4); border: 1px solid rgba(217,180,92,.28); border-radius: 3px;
  font-family: var(--f-body); font-size: 17px; line-height: 1.45; transition: border-color .2s ease, box-shadow .2s ease;
}
.bk-edit textarea { resize: vertical; min-height: 140px; }
.bk-edit select { cursor: pointer; }
.bk-edit option, .bk-edit optgroup { background: #120b08; color: var(--bone); }
.bk-edit input:focus, .bk-edit select:focus, .bk-edit textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217,180,92,.12); }
.bk-edit select:disabled, .bk-edit input:disabled { opacity: .55; cursor: not-allowed; }
.ed-count { margin-top: 3px; text-align: right; font-family: var(--f-mono); font-size: 11px; color: var(--bone-3); }
.ed-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-cat { --c: var(--gold); --c-rgb: 217,180,92; display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px 7px 10px; cursor: pointer; font-family: var(--f-ui); font-weight: 700; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--bone-3); background: transparent; border: 1px solid rgba(var(--c-rgb), .3); border-radius: 20px; transition: all .25s ease; }
.ed-cat svg { width: 16px; height: 16px; color: var(--c); }
.ed-cat:hover:not(:disabled) { color: var(--bone); border-color: var(--c); }
.ed-cat.is-on { color: var(--c); border-color: var(--c); background: rgba(var(--c-rgb), .14); box-shadow: 0 0 14px rgba(var(--c-rgb), .18); }
.ed-cat:disabled { cursor: not-allowed; opacity: .55; }
.ed-check { display: inline-flex; align-items: center; gap: 10px; margin-top: 16px; cursor: pointer; font-size: 17px; color: var(--bone-2); }
.ed-check input { width: 18px; height: 18px; accent-color: var(--gold); }

.ed-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 12px; }
.ed-h h4 { margin: 0; font-family: var(--f-ui); font-weight: 700; font-size: 17px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-hi); }
.ed-hint { font-style: italic; font-size: 15px; color: var(--bone-3); }
.ed-rows { display: flex; flex-direction: column; gap: 8px; }
.ed-empty { margin: 4px 0; font-style: italic; color: var(--bone-3); }
.ed-row { display: grid; grid-template-columns: minmax(120px, 1.2fr) 152px minmax(150px, 1.5fr) auto; gap: 8px; align-items: center; padding: 8px; background: rgba(255,255,255,.02); border: 1px solid rgba(217,180,92,.16); border-radius: 3px; }
.ed-v { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ed-v input[type="range"] { flex: 1; min-width: 0; accent-color: var(--gold); }
.ed-out { min-width: 22px; text-align: right; font-family: var(--f-mono); font-size: 14px; color: var(--gold-hi); }
.ed-ctl { display: inline-flex; gap: 4px; }
.ed-ib { width: 30px; height: 32px; padding: 0; cursor: pointer; font-size: 16px; line-height: 1; color: var(--bone-2); background: transparent; border: 1px solid rgba(217,180,92,.22); border-radius: 3px; transition: all .2s ease; }
.ed-ib:hover:not(:disabled) { color: var(--gold-hi); border-color: var(--gold); background: rgba(217,180,92,.1); }
.ed-ib:last-child:hover:not(:disabled) { color: #e08a8a; border-color: #e08a8a; background: rgba(224,138,138,.1); }
.ed-ib:disabled { opacity: .3; cursor: default; }
.ed-add { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ed-addrow { padding: 7px 14px; font-size: 14px; }
.ed-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ed-presets > span { margin-right: 4px; font-size: 14px; font-style: italic; color: var(--bone-3); }
.ed-chip { padding: 4px 11px; cursor: pointer; font-family: var(--f-body); font-size: 15px; color: var(--bone-2); background: rgba(217,180,92,.05); border: 1px solid rgba(217,180,92,.3); border-radius: 14px; transition: all .2s ease; }
.ed-chip:hover { color: var(--gold-hi); border-color: var(--gold); background: rgba(217,180,92,.12); transform: translateY(-1px); }

.ed-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 14px 28px 18px; border-top: 1px solid rgba(217,180,92,.2); background: rgba(0,0,0,.22); }
.ed-msg { flex: 1; min-width: 160px; margin: 0; font-size: 16px; color: var(--bone-3); }
.ed-msg.err { color: #e08a8a; }
.ed-actions { display: flex; gap: 10px; margin-left: auto; }

.bk-toast { position: fixed; left: 50%; bottom: 28px; z-index: 600; transform: translate(-50%, 20px); max-width: min(520px, 92vw); padding: 12px 22px; opacity: 0; pointer-events: none; font-size: 17px; color: var(--bone); background: #170f0a; border: 1px solid rgba(217,180,92,.5); border-radius: 3px; box-shadow: 0 16px 44px rgba(0,0,0,.7); transition: opacity .3s ease, transform .3s ease; }
.bk-toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .ed-top { grid-template-columns: 1fr; }
  .ed-prev { width: 96px; height: 128px; margin: 0 0 4px; }
  .ed-row { grid-template-columns: 1fr 1fr; }
  .ed-row .ed-k { grid-column: 1 / -1; }
  .ed-v { grid-column: 1 / -1; }
  .ed-ctl { grid-column: 1 / -1; justify-content: flex-end; }
  .ed-head { padding: 20px 56px 12px 18px; } .ed-body { padding: 14px 18px 4px; } .ed-foot { padding: 12px 18px 16px; }
}

/* основные характеристики существа (как в листе персонажа) */
.attr-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.attr { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px 8px; text-align: center; background: rgba(var(--c-rgb), .06); border: 1px solid rgba(var(--c-rgb), .28); border-top: 2px solid var(--c); border-radius: 2px; }
.attr .an { font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--bone-3); line-height: 1.2; overflow-wrap: anywhere; }
.attr .av { font-family: var(--f-title); font-weight: 400; font-size: 30px; line-height: 1.1; color: var(--gold-hi); }
.attr .ad { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .04em; color: var(--bone-3); }
@media (max-width: 760px) { .attr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* основные характеристики в окне редактора */
.ed-sub-h { margin: 14px 0 8px; font-family: var(--f-ui); font-weight: 700; font-size: 15px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.ed-sub-h i { font-style: italic; font-weight: 400; letter-spacing: .02em; text-transform: none; color: var(--bone-3); font-family: var(--f-body); font-size: 14px; }
.ed-attrs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ed-attr { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; background: rgba(255,255,255,.02); border: 1px solid rgba(217,180,92,.18); border-radius: 3px; }
.ed-attr label { font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--bone-3); }
.bk-edit .ed-attr input[type="number"] { width: 100%; padding: 6px 8px; text-align: center; color: var(--gold-hi); background: rgba(0,0,0,.4); border: 1px solid rgba(217,180,92,.28); border-radius: 3px; font-family: var(--f-title); font-size: 22px; line-height: 1.2; -moz-appearance: textfield; }
.bk-edit .ed-attr input[type="number"]::-webkit-outer-spin-button, .bk-edit .ed-attr input[type="number"]::-webkit-inner-spin-button { opacity: .5; }
.bk-edit .ed-attr input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217,180,92,.12); }
.ed-attr-d { min-height: 1.3em; text-align: center; font-family: var(--f-mono); font-size: 11.5px; color: var(--bone-3); }
.ed-attr-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
@media (max-width: 720px) { .ed-attrs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
