/* Глава «Гранд-базар»: изразцы, латунь, крытые улицы, план-книга цеха. Все селекторы с префиксом bz-. */

/* ---------- план-книга Хранителя ---------- */
.as-keeper .panel[data-type^="bz_"] .pbody {
  background:
    radial-gradient(110% 70% at 50% 0%, #fbf3df 0%, transparent 70%),
    repeating-linear-gradient(90deg, #00000005 0 1px, transparent 1px 5px),
    linear-gradient(#f3e5c8, #e6d2a8);
  border-color: #8a5a3a;
  box-shadow: inset 0 0 0 5px #f7ecd4, inset 0 0 0 6px #2753a6, inset 0 0 0 8px #f7ecd4, inset 0 0 0 9px #a3261c, inset 0 0 36px #7a3a1a2a, 0 8px 22px #0006;
}
.bz-doc { position: relative; font-family: Georgia, "Times New Roman", serif; color: #3a2010; font-variant-numeric: lining-nums; }
.bz-doc-head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 2px 0 12px; }
.bz-doc-head h4 { margin: 0; font: italic 600 17px Georgia, serif; color: #7a2a14; text-align: center; }
.bz-doc-foot { display: flex; justify-content: center; margin-top: 6px; opacity: .7; }
.bz-orn { width: 140px; height: 22px; fill: none; stroke: #2753a6; stroke-width: 1.4; stroke-linecap: round; }
.bz-doc .lead { font-weight: 600; }
.bz-tbl th, .bz-tbl td { border-color: #b08a5a; }
.bz-tbl th { background: #ead6ac; }
.bz-tbl td.bz-cur, .bz-tbl th.bz-cur { background: #f7e2b0; box-shadow: inset 0 0 0 2px #a3261c; }
.bz-rules { margin: 0 0 10px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.bz-doc.bz-k-err { animation: bz-kerr .5s; }
@keyframes bz-kerr { 25% { transform: translateX(-5px) rotate(-.6deg); } 60% { transform: translateX(4px) rotate(.5deg); } }
.bz-doc.bz-k-err::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 60% 40%, #a3261c40, transparent 40%); animation: bz-fade 1s forwards; }
@keyframes bz-fade { to { opacity: 0; } }
.bz-sealrow { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-weight: 700; color: #7a2a14; margin-bottom: -6px; }
.bz-seal { position: relative; width: 58px; height: 58px; flex: none; display: grid; place-items: center; animation: bz-stamp .5s cubic-bezier(.3,1.6,.6,1) both; transform: rotate(-10deg); }
.bz-seal svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bz-seal circle { fill: none; stroke: #a3261c; stroke-width: 3; }
.bz-seal circle.i { stroke-width: 1.4; }
.bz-seal circle.d { fill: #a3261c; stroke: none; }
.bz-seal b { position: relative; font: 700 26px Georgia, serif; color: #a3261c; }
@keyframes bz-stamp { from { transform: rotate(-10deg) scale(2.2); opacity: 0; } to { transform: rotate(-10deg) scale(1); opacity: 1; } }

/* ---------- плитки ---------- */
.bz-tiles { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bz-panel { position: relative; width: 100%; max-width: 330px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px; border-radius: 10px;
  background: #1f3d7a; box-shadow: inset 0 0 0 3px #e6c675, 0 6px 18px #0008; }
.bz-tile { border: 0; padding: 0; background: none; cursor: pointer; aspect-ratio: 1; border-radius: 6px; overflow: hidden; }
.bz-tile > svg { display: block; width: 100%; height: 100%; }
.bz-tile:disabled { cursor: default; }
.bz-tile:active:not(:disabled) { transform: scale(.96); }
.bz-glaze { fill: #f7f3ea; }
.bz-fl { transform-box: view-box; transform-origin: 50px 50px; transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
.bz-shine { fill: url(#bzShineG); fill: #fff; opacity: 0; animation: bz-shine 6s ease-in-out infinite; pointer-events: none; }
@keyframes bz-shine { 0%, 82%, 100% { opacity: 0; } 88% { opacity: .35; } }
.bz-tile.center { box-shadow: 0 0 0 2px #e6c675; }
.bz-crack { position: absolute; inset: 0; pointer-events: none; opacity: 0; border-radius: 10px;
  background: linear-gradient(115deg, transparent 46%, #3a2010 47%, transparent 48%), linear-gradient(35deg, transparent 58%, #3a2010 59%, transparent 60%), linear-gradient(160deg, transparent 30%, #3a2010 31%, transparent 32%); }
.bz-tiles.bz-err .bz-crack { animation: bz-crack 1s; }
@keyframes bz-crack { 10%, 60% { opacity: .8; } 100% { opacity: 0; } }
.bz-tiles.bz-err .bz-panel { animation: bz-heat .8s; }
@keyframes bz-heat { 30% { box-shadow: inset 0 0 0 3px #ff5a3a, 0 0 30px #ff5a3a; } }
.bz-tiles.bz-kiln .bz-panel { animation: bz-kiln 1.6s ease-out; }
@keyframes bz-kiln { 0% { filter: brightness(1); } 30% { filter: brightness(1.5) saturate(1.3); box-shadow: inset 0 0 0 3px #fff6cf, 0 0 40px #ffd25a; } 100% { filter: brightness(1); } }
.bz-tiles.bz-done .bz-panel { box-shadow: inset 0 0 0 3px #fff2b8, 0 0 22px #ffd25a88; }
.bz-tiles.bz-done .bz-shine { animation-duration: 2.4s; }
.bz-hint { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
/* итог модуля: управление убрано, остаётся то, что получилось */
div.bz-ctl { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bz-done .bz-ctl { display: none !important; }
.bz-cm { pointer-events: none; }
.bz-fire { width: 100%; }
.bz-syms { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bz-symrow, .bz-row { display: flex; align-items: center; gap: 10px; }
.bz-row p { margin: 0; }
.bz-mini { width: 56px; height: 56px; flex: none; }
.bz-mini rect { fill: #f7efdc; stroke: #8a6a3a; stroke-width: 1.2; }
.bz-mini rect.c.blue { fill: #2753a6; }
.bz-mini rect.c.turq { fill: #1f9e9a; }
.bz-mini rect.c.red { fill: #c43a2f; }
.bz-mini .ax { stroke: #a3261c; stroke-width: 2; stroke-dasharray: 4 3; }
.bz-mini .ar, .bz-mini .bad { fill: none; stroke: #3a2010; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bz-mini .frame { fill: #f7efdc; }
.bz-mini .x { stroke: #a3261c; stroke-width: 3; stroke-linecap: round; }

/* ---------- ключи ---------- */
.bz-keys { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bz-door { width: 120px; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 2px #2a1a0c, 0 6px 14px #0008; }
.bz-plate { display: block; width: 100%; }
.bz-ring { position: relative; width: 100%; display: flex; flex-direction: column; gap: 4px; padding-left: 14px; }
.bz-ringwire { position: absolute; left: 4px; top: 14px; bottom: 14px; width: 26px; border: 4px solid #b9b9b9; border-right: 0; border-radius: 16px 0 0 16px; }
.bz-key { position: relative; border: 0; padding: 4px 6px; border-radius: 10px; background: #2a2119; cursor: pointer; box-shadow: inset 0 0 0 1.5px #4a3a2a; transition: transform .25s, box-shadow .2s, background .2s; }
.bz-key > svg { display: block; width: 100%; height: auto; max-height: 60px; }
.bz-key .hole { fill: #2a2119; }
.bz-key.sel { background: #3d2f20; box-shadow: inset 0 0 0 2px var(--brass2), 0 0 14px #e6c67555; transform: translateX(8px); }
.bz-key.sel .hole { fill: #3d2f20; }
.bz-key:disabled { cursor: default; }
.bz-guide { stroke: #ffffff22; stroke-width: 1; stroke-dasharray: 2 3; }
.bz-key.bz-jam { animation: bz-jam .6s; }
@keyframes bz-jam { 0% { transform: translateX(8px); } 30% { transform: translateX(30px); } 45% { transform: translateX(24px) rotate(-2deg); } 60% { transform: translateX(28px) rotate(2deg); } 100% { transform: translateX(8px); } }
.bz-key.bz-in { animation: bz-in 1s forwards; }
@keyframes bz-in { 40% { transform: translateX(40px); } 100% { transform: translateX(40px) scaleY(-1); } }
.bz-keys.bz-err .bz-door { animation: bz-heat .7s; }
.bz-kh { transform-box: fill-box; transform-origin: center; transition: transform .6s; }
.bz-keys.bz-done .bz-kh { transform: rotate(90deg); }
.bz-keys.bz-done .bz-door { width: 150px; box-shadow: 0 0 0 2px #e6c675, 0 0 22px #ffd25a88; }
.bz-door { transition: width .4s; }
.bz-kin { opacity: 0; transition: opacity .4s .5s; }
.bz-keys.bz-done .bz-kin { opacity: 1; }
.bz-use { width: 100%; }
.bz-today { display: flex; align-items: center; gap: 12px; font-weight: 700; padding: 6px 12px; margin-bottom: 12px; background: #fff6e2; border: 2px dashed #b08a5a; border-radius: 12px; }
.bz-wax { width: 30px; height: 30px; vertical-align: middle; }
.bz-wax.big { width: 48px; height: 48px; }
.bz-code { display: block; font: 700 17px Georgia, serif; letter-spacing: .04em; }
.bz-mkey { width: 60px; height: 20px; display: block; margin: 2px auto 0; fill: #3a2010; stroke: #3a2010; stroke-width: 1.6; }
.bz-mkey circle { fill: none; }

/* ---------- улицы ---------- */
.bz-streets { display: flex; justify-content: center; }
.bz-cross { width: 100%; max-width: 330px; display: grid; grid-template-columns: 1fr 1.15fr 1fr; grid-template-rows: auto auto auto; gap: 6px; grid-template-areas: ". f ." "l c r" ". b ."; align-items: center; }
.bz-cross.bz-walk { animation: bz-walk .45s ease-out; }
@keyframes bz-walk { from { transform: scale(.82); opacity: .2; filter: blur(2px); } }
.bz-pass { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 10px; }
.bz-pass > svg { display: block; width: 100%; height: auto; }
.bz-pass:disabled { cursor: default; }
.bz-pass:not(:disabled):active { transform: scale(.95); }
.bz-pass.bz-f { grid-area: f; }
.bz-pass.bz-l { grid-area: l; }
.bz-pass.bz-r { grid-area: r; }
.bz-pass.bz-b { grid-area: b; opacity: .85; }
.bz-cross.bz-solved .bz-pass:not(.bz-opened) { opacity: .3; filter: grayscale(.6); }
.bz-plaza { grid-area: c; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 2px #8a6a3a; }
.bz-plaza svg { display: block; width: 100%; }
.bz-you { animation: bz-you 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes bz-you { 50% { transform: translateY(-4px); } }
.bz-sign { transform-box: fill-box; transform-origin: 50% 0; animation: bz-swing 3.2s ease-in-out infinite; }
@keyframes bz-swing { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.bz-far { fill: #ffd27a; animation: bz-flick 2.4s ease-in-out infinite; }
@keyframes bz-flick { 50% { opacity: .55; } }
.bz-daylight { fill: #fff; opacity: .3; animation: bz-flick 4s ease-in-out infinite; }
.bz-shutter { transform-box: fill-box; transform-origin: 50% 0; transition: transform 1s ease-in; }
.bz-shutter.bz-shake { animation: bz-shake .5s; }
@keyframes bz-shake { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.bz-pass.bz-opened .bz-shutter { transform: scaleY(.08); }
.bz-pass.bz-opened > svg { filter: drop-shadow(0 0 10px #ffd25a); }
.bz-plan { width: 100%; display: block; margin: 4px 0 12px; }
.bz-roof { fill: none; stroke: #8a6a3a; stroke-width: 1.2; stroke-dasharray: 2 4; }
.bz-st { stroke: #3a2010; stroke-width: 20; stroke-linecap: round; }
.bz-st2 { stroke: #f0dfba; stroke-width: 15; stroke-linecap: round; }
.bz-stc { fill: #f7ecd4; stroke: #3a2010; stroke-width: 1.6; }
.bz-stic { color: #7a2a14; }
.bz-node { fill: #3a2010; stroke: #f7ecd4; stroke-width: 3; }
.bz-shopbox { fill: #f7ecd4; stroke: #3a2010; stroke-width: 1.6; }
.bz-shopic { color: #3a2010; }
.bz-tgt { fill: none; stroke: #a3261c; stroke-width: 3; stroke-dasharray: 5 3; }
.bz-star path { fill: #a3261c; }

/* ---------- весы ---------- */
.bz-scales { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bz-bal { width: 100%; max-width: 360px; display: block; overflow: visible; }
.bz-beam { transform-box: view-box; transform-origin: 160px 58px; transition: transform 1.1s cubic-bezier(.3,1.5,.5,1); }
.bz-pan { transition: transform 1.1s cubic-bezier(.3,1.5,.5,1); }
.bz-clamp { opacity: 0; transform: translateY(18px); transition: opacity .35s, transform .35s; }
.bz-clamp.on { opacity: 1; transform: none; }
.bz-tray { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: 100%; }
.bz-w { border: 0; padding: 6px 2px; border-radius: 10px; background: #2a2119; box-shadow: inset 0 0 0 1.5px #4a3a2a; cursor: pointer; transition: transform .2s, background .2s; }
.bz-w > svg { width: 100%; height: auto; max-height: 48px; display: block; }
.bz-w.on { background: #4a3a22; box-shadow: inset 0 0 0 2px var(--brass2); transform: translateY(-4px); opacity: .55; }
.bz-w:disabled { cursor: default; }
.bz-weigh { width: 100%; }
.bz-scales.bz-err .bz-bal { animation: bz-wob .6s; }
@keyframes bz-wob { 30% { filter: drop-shadow(0 0 8px #ff5a3a); } }
.bz-scales.bz-even .bz-bal { animation: bz-even 1.4s; }
@keyframes bz-even { 40% { filter: drop-shadow(0 0 14px #ffd25a); } }
.bz-metal { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; box-shadow: inset 0 0 0 1px #0006; }
.bz-metal.brass { background: linear-gradient(135deg, #f3dc9b, #c9a24a 50%, #6d501b); }
.bz-metal.iron { background: linear-gradient(135deg, #a8a8a8, #6a6a6a 50%, #2c2c2c); }
.bz-wico { width: 40px; height: 40px; }
.bz-metalh { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- замок ---------- */
.bz-lock { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bz-shackle { width: 54%; max-width: 200px; display: block; margin-bottom: -16px; transition: transform .6s cubic-bezier(.3,1.6,.6,1); position: relative; z-index: 0; }
.bz-lock.bz-done .bz-shackle, .bz-lock.bz-sprung .bz-shackle { transform: translateY(-18px); }
.bz-body { position: relative; z-index: 1; width: 100%; max-width: 360px; padding: 12px 10px 14px; border-radius: 18px;
  background: linear-gradient(135deg, #f3dc9b, #c9a24a 45%, #8a6a2a); box-shadow: inset 0 0 0 3px #6d501b, inset 0 0 0 7px #e6c675, 0 8px 18px #0009; }
.bz-lamps { display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; }
.bz-lamp { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #3a2c1c; color: #8a7656; box-shadow: inset 0 0 0 1.5px #6d501b; }
.bz-lamp .ic { width: 20px; height: 20px; }
.bz-lamp.on { background: radial-gradient(#fff6d0, #ffc84a 70%); color: #5a3a00; box-shadow: 0 0 10px #ffc84a; }
.bz-wheels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bz-wheel { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bz-tag { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: #f7ecd4; color: #3a2010; box-shadow: 0 2px 0 #6d501b; }
.bz-tag .ic { width: 22px; height: 22px; }
.btn.bz-spin { min-height: 40px; width: 100%; padding: 0; font-size: 16px; }
.bz-win { width: 100%; height: 156px; overflow: hidden; border-radius: 10px; background: #2a1a0c;
  box-shadow: inset 0 0 0 2px #6d501b, inset 0 14px 14px -6px #000, inset 0 -14px 14px -6px #000; position: relative; }
.bz-win::after { content: ""; position: absolute; left: 2px; right: 2px; top: 52px; height: 52px; border-top: 2px solid #e6c675; border-bottom: 2px solid #e6c675; pointer-events: none; }
.bz-strip { transition: transform .3s cubic-bezier(.3,1.3,.5,1); }
.bz-cell { height: 52px; display: grid; place-items: center; color: #f3e2b0; }
.bz-cell .ic { width: 32px; height: 32px; }
.bz-chains { position: absolute; inset: 40px 8px 8px; pointer-events: none; border-radius: 10px;
  background: repeating-linear-gradient(35deg, transparent 0 18px, #7a7a7acc 18px 22px, transparent 22px 40px), repeating-linear-gradient(-35deg, transparent 0 18px, #9a9a9acc 18px 22px, transparent 22px 40px);
  transition: opacity .8s, transform .8s; }
.bz-lock.open .bz-chains { opacity: 0; transform: translateY(30px); }
.bz-lock.bz-unchain .bz-body { animation: bz-even 1.2s; }
.bz-lock:not(.open) .bz-win { filter: brightness(.6); }
.bz-openbtn { width: 100%; }
.bz-lock.bz-err .bz-body { animation: bz-shake .5s; }
.bz-lock.bz-done .bz-body { box-shadow: inset 0 0 0 3px #6d501b, inset 0 0 0 7px #fff2b8, 0 0 26px #ffd25a; }
.bz-recs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.bz-rec { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border: 1px solid #b08a5a; border-radius: 10px; background: #fff8e8; }
.bz-rec .bz-seal { width: 46px; height: 46px; }
.bz-rec .bz-seal b { font-size: 20px; }
.bz-empty { width: 46px; height: 46px; border-radius: 50%; border: 2px dashed #b08a5a; }
.bz-locktbl td, .bz-locktbl th { padding: 4px 1px; }
.bz-locktbl .ic { width: 22px; height: 22px; }
.bz-locktbl th .ic.big { width: 26px; height: 26px; }

/* ---------- сцена победы ---------- */
.bzw-scene { width: 100%; display: block; border-radius: 12px; margin-bottom: 12px; }

.bzw-door { transform-box: view-box; transition: none; }
.bzw-door.l { transform-origin: 98px 100px; animation: bz-doorl 1.8s .4s cubic-bezier(.5,0,.3,1) forwards; }
.bzw-door.r { transform-origin: 222px 100px; animation: bz-doorr 1.8s .4s cubic-bezier(.5,0,.3,1) forwards; }
@keyframes bz-doorl { to { transform: scaleX(.12); filter: brightness(.6); } }
@keyframes bz-doorr { to { transform: scaleX(.12); filter: brightness(.6); } }
.bzw-floor { opacity: 0; animation: bz-light 1.2s 1s forwards; }
@keyframes bz-light { to { opacity: 1; } }
.bzw-lamps circle { animation: bz-flick 2s ease-in-out infinite; }
.bzw-motes circle { opacity: 0; animation: bz-mote 4s ease-in-out infinite; }
@keyframes bz-mote { 0% { opacity: 0; transform: translateY(6px); } 50% { opacity: .9; } 100% { opacity: 0; transform: translateY(-10px); } }
