/* 📖 Книга крафтов — разворот (23.10.2026, префикс cb-). Тёмная бумага в цвет приложения, золотой кант, как страницы в книге Таумкрафта. */
body.cb-lock { overflow: hidden; }
.cb-root { position: fixed; inset: 0; z-index: 1400; background: radial-gradient(ellipse at 50% 0%, #2a1634 0%, #120a1a 62%, #0a0710 100%); overflow: hidden;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); animation: cb-in .28s ease both; }
@keyframes cb-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.cb-book { height: 100%; max-width: 1020px; margin: 0 auto; display: flex; flex-direction: column; padding: 10px 12px 8px; box-sizing: border-box; }

.cb-top { display: flex; align-items: center; gap: 10px; padding: 2px 0 10px; }
.cb-x { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 214, 150, .3); background: rgba(40, 20, 48, .8); color: #ffe6c2; display: grid; place-items: center; cursor: pointer; }
.cb-x .ui-svg, .cb-x svg { width: 18px; height: 18px; transform: rotate(180deg); }
.cb-chapters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; padding: 2px 0; }
.cb-chapters::-webkit-scrollbar { display: none; }
.cb-chip { flex: none; padding: 9px 14px; border-radius: 999px; border: 1px solid rgba(255, 214, 150, .22); background: rgba(36, 18, 44, .7); color: #d9c3dd; font: 700 13px var(--sans, Jost); cursor: pointer; }
.cb-chip.on { background: linear-gradient(135deg, #7a3a74, #4a2470); border-color: rgba(255, 214, 150, .6); color: #fff2d6; box-shadow: 0 0 16px rgba(255, 170, 120, .18); }

.cb-spread { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: 1fr; gap: 12px; position: relative; padding: 2px 2px 14px; -webkit-overflow-scrolling: touch; }
.cb-spine { display: none; }
@media (max-width: 759px) { .cb-right { order: -1; } }          /* на телефоне картинка-конструкция выше описания: с неё всё и делается */
@media (min-width: 760px) {
  .cb-spread { grid-template-columns: 1fr 1fr; gap: 0; align-content: start; }
  .cb-spine { display: block; position: absolute; left: 50%; top: 0; bottom: 14px; width: 26px; transform: translateX(-50%); pointer-events: none;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .5) 50%, rgba(0, 0, 0, 0)); }
  .cb-left { border-radius: 18px 4px 4px 18px; }
  .cb-right { border-radius: 4px 18px 18px 4px; }
}
.cb-spread.turn-next .cb-page { animation: cb-next .32s ease both; }
.cb-spread.turn-prev .cb-page { animation: cb-prev .32s ease both; }
@keyframes cb-next { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes cb-prev { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }

.cb-page { position: relative; padding: 18px 18px 16px; border-radius: 16px; border: 1px solid rgba(255, 214, 150, .24); color: #f2e4d2;
  background: linear-gradient(165deg, #33203b 0%, #261630 55%, #1d1026 100%); box-shadow: inset 0 0 46px rgba(0, 0, 0, .38), 0 10px 28px rgba(0, 0, 0, .35); min-width: 0; }
.cb-page::before { content: ''; position: absolute; inset: 7px; border-radius: 11px; border: 1px solid rgba(255, 214, 150, .1); pointer-events: none; }

.cb-orn { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 8px; }
.cb-orn i { height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 214, 150, .55)); position: relative; }
.cb-orn i:last-child { background: linear-gradient(270deg, transparent, rgba(255, 214, 150, .55)); }
.cb-orn i::after { content: ''; position: absolute; top: -2px; right: 0; width: 5px; height: 5px; background: #ffd9a0; transform: rotate(45deg); }
.cb-orn i:last-child::after { right: auto; left: 0; }
.cb-orn b { font: 700 20px/1.1 var(--serif, 'Philosopher', serif); color: #ffe9c8; text-align: center; letter-spacing: .02em; text-shadow: 0 2px 10px rgba(0, 0, 0, .5); max-width: 62vw; }
.cb-sub { text-align: center; font-size: 12px; color: #c8aec9; margin-bottom: 12px; letter-spacing: .04em; }
.cb-text { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: #efe0cf; }
.cb-how { color: #d4bfd2; font-size: 13px; }
.cb-stamp { display: inline-block; margin: 4px 0 10px; padding: 6px 14px; border-radius: 8px; border: 1.5px solid #ffd9a0; color: #ffd9a0; font: 800 13px var(--sans, Jost); text-transform: uppercase; letter-spacing: .08em; transform: rotate(-3deg); }
.cb-stamp.lock { border-color: #e98ab0; color: #f3a9c6; }

.cb-reqs { display: grid; gap: 8px; margin: 10px 0 12px; }
.cb-req { display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(12, 6, 18, .42); border: 1px solid rgba(255, 255, 255, .08); }
.cb-req.miss { border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.cb-req-ico { width: 42px; height: 42px; }
.cb-req-main { display: grid; gap: 2px; min-width: 0; }
.cb-req-main b { font-size: 14px; color: #fff1dc; }
.cb-req-have { font-size: 13px; color: #e8d6e6; font-variant-numeric: tabular-nums; }
.cb-req-main em { font-style: normal; font-size: 12px; color: #ffcf8a; line-height: 1.3; }
.cb-req-main em.ok { color: #f6d6ff; }
.cb-lfoot { display: flex; justify-content: center; }
.cb-pin { padding: 9px 16px; border-radius: 999px; border: 1px solid rgba(255, 214, 150, .35); background: transparent; color: #ffe0b0; font: 700 12px var(--sans, Jost); cursor: pointer; }
.cb-pin.on { background: rgba(255, 214, 150, .12); }

/* правая страница */
.cb-stage { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 8px auto 10px; }
.cb-glyph { position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 190, 140, .1) 0%, rgba(255, 190, 140, 0) 64%),
    repeating-conic-gradient(from 0deg, rgba(255, 214, 150, .07) 0 4deg, transparent 4deg 22.5deg);
  mask: radial-gradient(circle, #000 66%, transparent 71%); -webkit-mask: radial-gradient(circle, #000 66%, transparent 71%); }
.cb-ring { position: absolute; left: 50%; top: 50%; width: var(--rad); height: var(--rad); transform: translate(-50%, -50%); border-radius: 50%; border: 1px dashed rgba(255, 214, 150, .22); pointer-events: none; }
.cb-cell { position: absolute; width: 14%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; padding: 0; box-sizing: border-box; cursor: pointer; min-width: 0; min-height: 0; -webkit-tap-highlight-color: transparent;
  background: rgba(14, 7, 20, .7); border: 1.5px dashed rgba(255, 255, 255, .3); transition: background .2s, border-color .2s, box-shadow .2s; }
.cb-cell-gem { position: absolute; inset: 0; display: block; border-radius: 50%; overflow: hidden; opacity: .3; filter: grayscale(.9); transition: opacity .2s, filter .2s; }
.cb-cell.can { border-color: var(--c); }
.cb-cell.can .cb-cell-gem { opacity: .55; filter: grayscale(.4); }
.cb-cell.cant { border-color: rgba(255, 255, 255, .14); }
.cb-cell.full { border-style: solid; border-color: var(--c); background: radial-gradient(circle, color-mix(in srgb, var(--c) 38%, #140a1e), #140a1e 78%); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 55%, transparent); }
.cb-cell.full .cb-cell-gem { opacity: 1; filter: none; }
.cb-cell.cb-pop { animation: cb-pop .38s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes cb-pop { 0% { transform: translate(-50%, -50%) scale(.5); } 100% { transform: translate(-50%, -50%) scale(1); } }
.cb-cell.cb-no { animation: cb-no .32s; }
@keyframes cb-no { 0%, 100% { transform: translate(-50%, -50%); } 25% { transform: translate(calc(-50% - 4px), -50%); } 75% { transform: translate(calc(-50% + 4px), -50%); } }

.cb-core { position: absolute; left: 50%; top: 50%; width: 25%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; padding: 0; overflow: hidden; display: grid; place-items: center;
  border: 2px solid rgba(255, 214, 150, .4); background: radial-gradient(circle, #3b2346, #170c20 80%); color: #ffe6c2; cursor: pointer; transition: box-shadow .25s, border-color .25s, transform .25s; }
.cb-core.static { cursor: default; border-color: rgba(255, 214, 150, .7); box-shadow: 0 0 24px rgba(255, 190, 120, .35); }
.cb-core .cb-cart { width: 78%; height: 78%; display: block; }
.cb-core .cb-cimg { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 42%; display: block; border-radius: 50%; }
.cb-core .cb-cimg.cb-loc { transform: scale(1.12); }          /* баннер локации широкий (1344×576): круг вырезает середину, края не нужны */
.cb-core .cb-cemo { font-size: 30px; }
.cb-core:not(.ready):not(.static) { filter: saturate(.6) brightness(.85); }
.cb-core.ready { border-color: #ffe08a; box-shadow: 0 0 26px rgba(255, 214, 130, .75), 0 0 0 6px rgba(255, 214, 130, .18); animation: cb-ready 1.4s ease-in-out infinite; }
@keyframes cb-ready { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.07); } }
.cb-core.crafting { animation: cb-craft .7s ease-in-out infinite; }
@keyframes cb-craft { 0%, 100% { transform: translate(-50%, -50%) rotate(-4deg) scale(1.1); } 50% { transform: translate(-50%, -50%) rotate(4deg) scale(1.2); } }
.cb-stage.cb-flash::after { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255, 230, 160, .9), rgba(255, 230, 160, 0) 65%); animation: cb-flash .8s ease-out both; }
@keyframes cb-flash { from { opacity: 1; transform: scale(.3); } to { opacity: 0; transform: scale(1.4); } }

.cb-progress { text-align: center; font-size: 12.5px; color: #d9c3dd; min-height: 18px; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.cb-rfoot { display: grid; gap: 10px; }
.cb-badges { display: flex; justify-content: center; gap: 14px; }
.cb-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); background: rgba(14, 7, 20, .6); }
.cb-badge i { width: 28px; height: 28px; display: block; }
.cb-badge b { font-size: 14px; color: #fff1dc; font-variant-numeric: tabular-nums; }
.cb-acts { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.cb-all { padding: 12px 16px; border-radius: 14px; border: 1px solid rgba(255, 214, 150, .35); background: transparent; color: #ffe0b0; font: 700 13px var(--sans, Jost); cursor: pointer; }
.cb-make { margin: 0; }
.cb-make[disabled] { opacity: .45; }

.cb-nav { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 6px 0 2px; }
.cb-arrow { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 214, 150, .3); background: rgba(40, 20, 48, .8); color: #ffe6c2; display: grid; place-items: center; cursor: pointer; }
.cb-arrow[disabled] { opacity: .3; cursor: default; }
.cb-arrow svg { width: 18px; height: 18px; }
.cb-arrow.prev svg { transform: rotate(180deg); }
.cb-page-no { font-size: 13px; color: #cdb4d2; font-variant-numeric: tabular-nums; min-width: 56px; text-align: center; }

/* обложка-кнопка на вкладке «Книга крафтов» инвентаря */
.cb-cover { width: 100%; display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center; text-align: left; padding: 14px 16px; margin: 0 0 14px; cursor: pointer; border-radius: 18px;
  border: 1px solid rgba(255, 214, 150, .4); color: #fff1dc; background: linear-gradient(135deg, #4a2552, #2a1634); box-shadow: 0 8px 22px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 214, 150, .08); }
.cb-cover-ico { width: 76px; height: 76px; border-radius: 16px; overflow: hidden; background: radial-gradient(circle, #5a2f62, #231230); display: block; border: 1px solid rgba(255, 214, 150, .35); }
.cb-cover-ico img { width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }
.cb-cover b { display: block; font: 700 18px var(--serif, 'Philosopher', serif); color: #ffe9c8; }
.cb-cover span { display: block; font-size: 12.5px; color: #d9c3dd; margin-top: 2px; line-height: 1.35; }
.cb-cover .ui-svg, .cb-cover svg.chev { width: 18px; height: 18px; color: #ffd9a0; }

/* картинка предмета заполняет весь кружок ячейки (25.10.2026); значок, нарисованный кодом, остаётся с полями */
.cb-cell { overflow: hidden; }
.cb-cell-gem svg.cf-gem { padding: 17%; box-sizing: border-box; }
/* 12.11.2026 (владелица: «в книге крафтов алмаз должен быть посередине круглых ячеек, а не со смещением»): картинки предметов вписаны в квадрат по габариту всего предмета, а у кристалла вес
   сверху, и цветок с подставкой тянут его вправо (у ветвей цветы упирались в край круга и резались). Теперь картинка ставится так, чтобы ЦЕНТР МАСС предмета (по непрозрачности)
   оказался в центре круга, и вписывается в круг целиком: --fx / --fy — центр масс в долях картинки, --s — размер картинки в долях ячейки (наибольший, при котором предмет не касается края круга).
   Числа посчитаны по файлам `res_stone_*@2x.webp` и `res_stick_*@2x.webp`: центр масс = сумма координат пикселей, взвешенных по альфе, делённая на сумму альфы; размер — наибольший, при котором все пиксели
   с альфой > 60 лежат внутри круга радиуса 0,465 ячейки (не больше .90). Перегенерировали картинку — пересчитать её строку. Ячейка по-прежнему режет по кругу сама (.cb-cell-gem: overflow + border-radius),
   у картинки скругления нет. Ключ в `src` ищем по подстроке (после него `?v=`). */
.cb-cell-gem .cf-art { --fx: .5; --fy: .5; --s: 1; position: absolute; max-width: none; border-radius: 0; object-fit: contain;
  width: calc(var(--s) * 100%); height: calc(var(--s) * 100%);
  left: calc(50% - var(--fx) * var(--s) * 100%); top: calc(50% - var(--fy) * var(--s) * 100%); }
.cb-cell-gem .cf-art[src*="res_stone_pebble"]   { --fx: .571; --fy: .524; --s: .86; }
.cb-cell-gem .cf-art[src*="res_stone_quartz"]   { --fx: .482; --fy: .539; --s: .90; }
.cb-cell-gem .cf-art[src*="res_stone_lapis"]    { --fx: .519; --fy: .492; --s: .90; }
.cb-cell-gem .cf-art[src*="res_stone_amethyst"] { --fx: .504; --fy: .522; --s: .89; }
.cb-cell-gem .cf-art[src*="res_stone_amber"]    { --fx: .510; --fy: .499; --s: .84; }
.cb-cell-gem .cf-art[src*="res_stone_heart"]    { --fx: .502; --fy: .424; --s: .90; }
/* ветви: тёмная древесина на тёмной ячейке почти не видна, и глаз держится за светлые цветы, поэтому центр — среднее между силуэтом и видимой яркостью */
.cb-cell-gem .cf-art[src*="res_stick_bamboo"]   { --fx: .536; --fy: .459; --s: .72; }
.cb-cell-gem .cf-art[src*="res_stick_sakura"]   { --fx: .533; --fy: .437; --s: .76; }
.cb-cell-gem .cf-art[src*="res_stick_maple"]    { --fx: .483; --fy: .392; --s: .85; }
.cb-cell-gem .cf-art[src*="res_stick_willow"]   { --fx: .522; --fy: .408; --s: .86; }
.cb-cell-gem .cf-art[src*="res_stick_ebony"]    { --fx: .474; --fy: .374; --s: .73; }
.cb-cell-gem .cf-art[src*="res_stick_sky"]      { --fx: .564; --fy: .516; --s: .78; }
/* книга прямо во вкладке «Книга крафтов» (25.10.2026): не слой, а блок страницы */
.cb-root.inline { position: static; inset: auto; z-index: auto; background: none; overflow: visible; padding: 0; animation: none; }
.cb-root.inline .cb-book { height: auto; max-width: none; padding: 0 0 6px; }
.cb-root.inline .cb-x { display: none; }
.cb-root.inline .cb-top { padding-bottom: 8px; }
.cb-root.inline .cb-spread { overflow: visible; padding-bottom: 6px; }
.cb-root.inline .cb-nav { padding-top: 10px; }
.cb-host { margin: 0 0 16px; }

/* 31.10.2026: подсказка «как сделать» стоит под кнопками на правой странице */
.cb-rfoot .cb-how { margin: 2px 4px 0; font-size: 12.5px; line-height: 1.45; text-align: center; }
