/* BAN FB — поверх hub.css. */
.brand-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.all-games { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 12px; border: 3px solid var(--ink); background: var(--yellow);
  font-weight: 700; text-decoration: none; box-shadow: 4px 4px 0 var(--ink); white-space: nowrap; }
.all-games:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.small { font-size: 12px; margin: 10px 0 0; }

.bf-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; margin-bottom: 18px; }
.bf-title h1 { font-family: var(--font-head); margin: 0; font-size: clamp(38px, 4.6vw, 64px); line-height: .9; letter-spacing: -.04em; }
.bf-title .slogan { font-size: clamp(18px, 2vw, 28px); }
.bf-title .slogan { margin: 0; }

/* сетка игры */
.bf-game { display: grid; gap: 22px; margin-bottom: 30px;
  grid-template-columns: minmax(0, 330px) minmax(0, 1fr) minmax(0, 290px);
  grid-template-areas: "ctrl board hud" "ctrl board ladder"; grid-template-rows: auto 1fr; align-items: start; }
.bf-hud { grid-area: hud; }
.bf-board-wrap { grid-area: board; }
.bf-ctrl { grid-area: ctrl; }
.bf-ladder { grid-area: ladder; }

.bf-hud { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; border: 5px solid var(--ink); background: var(--ink); gap: 5px; box-shadow: 8px 8px 0 var(--ink); }
.hud-box { background: var(--paper); padding: 8px 12px; display: flex; flex-direction: column; min-width: 0; }
.hud-main { background: var(--yellow); grid-column: 1 / -1; }
@media (min-width: 1181px) { .bf-hud .hud-box:not(.hud-main) { grid-column: span 2; } }
.hud-k { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.hud-v { font-family: var(--font-num); font-weight: 700; font-size: clamp(17px, 1.5vw, 22px); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-main .hud-v { font-family: var(--font-head); font-size: clamp(22px, 2.4vw, 34px); }
.hud-v.bump { animation: bump .35s ease-out; }
@keyframes bump { 0% { transform: scale(1.25); color: var(--green); } 100% { transform: scale(1); } }

.bf-board-wrap { position: relative; }
.bf-phrase { min-height: 48px; display: flex; align-items: center; justify-content: center; text-align: center; margin-bottom: 12px;
  border: 3px solid var(--ink); background: var(--paper); padding: 6px 12px; font-weight: 700; font-size: 17px; }
.bf-phrase.is-win { background: #E7F6EE; border-color: var(--green); color: var(--green); }
.bf-phrase.is-ban { background: var(--red); color: var(--paper); }
.bf-phrase span { animation: phrase-in .3s ease-out; }
@keyframes phrase-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.bf-board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(6px, 1.1vw, 12px); padding: clamp(8px, 1.2vw, 14px);
  background: var(--ink); border: 5px solid var(--ink); box-shadow: 10px 10px 0 var(--yellow), 10px 10px 0 5px var(--ink); max-width: max(420px, min(640px, calc(100vh - 270px))); margin: 0 auto; }
.bf-board.shake { animation: shake .5s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(5px); } 30%, 50%, 70% { transform: translate(-9px, 3px) rotate(-.6deg); } 40%, 60% { transform: translate(9px, -3px) rotate(.6deg); } }

.cell { position: relative; aspect-ratio: 1 / 1; padding: 0; min-height: 0; border: 0; box-shadow: none; background: transparent; perspective: 700px;
  container-type: inline-size; text-transform: none; letter-spacing: 0; }
.cell:active { transform: none; box-shadow: none; }
.cell:disabled { opacity: 1; cursor: default; box-shadow: none; }
.cell-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3,1.5,.5,1); }
.cell.is-open .cell-in, .cell.is-ban .cell-in, .cell.is-ghost .cell-in, .cell.is-ghost-ban .cell-in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column;
  align-items: center; justify-content: center; border: 4px solid var(--paper); overflow: hidden; }
.face-front { background: #1C1C1C; border-color: #3A3A3A; }
.face-front::after { content: ""; width: 24%; height: 24%; background: var(--yellow); border: 3px solid var(--ink); box-shadow: 0 0 0 3px #3A3A3A; transition: transform .15s; }
.face-back { transform: rotateY(180deg); background: var(--paper); border-color: var(--paper); color: var(--ink); padding: 4%; }
.cell.can-open { cursor: pointer; }
.cell.can-open:hover .face-front { background: #2A2A2A; border-color: var(--yellow); }
.cell.can-open:hover .face-front::after { transform: scale(1.2) rotate(45deg); }
.cell.can-open:focus-visible { outline: 4px solid var(--yellow); outline-offset: 2px; }
.cell.is-pending .cell-in { animation: pend .5s ease-in-out infinite alternate; }
@keyframes pend { from { transform: rotateY(0) scale(1); } to { transform: rotateY(25deg) scale(.95); } }

.ok-mark { font-family: var(--font-head); color: var(--green); font-size: 30cqi; line-height: 1; }
.ok-lbl { font-family: "IBM Plex Mono", var(--font-mono); font-weight: 700; font-size: 14cqi; line-height: 1.05; text-align: center; text-transform: uppercase;
  margin-top: 5cqi; white-space: pre-line; overflow-wrap: anywhere; }
.cell.is-open .face-back { background: var(--paper); }
.cell.is-open.fresh .face-back { animation: flash .7s ease-out; }
@keyframes flash { 0% { background: var(--yellow); } 100% { background: var(--paper); } }
.cell .plus { position: absolute; left: 50%; top: 10%; transform: translateX(-50%); font-family: var(--font-num); font-weight: 700; font-size: 16cqi; color: var(--green);
  background: var(--paper); border: 2px solid var(--green); padding: 0 4px; pointer-events: none; animation: rise 1s ease-out forwards; z-index: 3; white-space: nowrap; }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, 20%); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -120%); } }

.cell.is-ban .face-back, .cell.is-ghost-ban .face-back { background: var(--red); border-color: var(--red); color: var(--paper); padding: 0; justify-content: flex-end; }
.cell.is-ban .face-back img, .cell.is-ghost-ban .face-back img { position: absolute; top: 4%; left: 50%; width: 62%; transform: translateX(-50%); filter: grayscale(1) contrast(1.1); }
.ban-lbl { position: relative; z-index: 1; width: 100%; background: var(--ink); color: var(--paper); text-align: center; font-family: "Archivo Black", "Onest", sans-serif; font-weight: 900;
  font-size: 17cqi; line-height: 1.25; letter-spacing: .04em; }
.cell.is-ban .face-back { box-shadow: inset 0 0 0 5cqi var(--yellow); }
.cell.is-ban .ban-lbl { background: var(--yellow); color: var(--ink); }
.cell.is-ghost .face-back { background: #D9D9D9; border-color: #D9D9D9; }
.cell.is-ghost .ok-mark { color: #8A8A8A; }
.cell.is-ghost-ban .cell-in, .cell.is-ghost .cell-in { transition-delay: var(--d, 0s); }
.cell.is-ghost-ban .face-back { opacity: .92; }

/* эффекты поверх поля */
.fx { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 12px; }
.fx-ban { background: rgba(180, 35, 24, .38); animation: fx-in .2s ease-out; }
@keyframes fx-in { from { opacity: 0; } to { opacity: 1; } }
.fx-ban-card, .fx-win-card { background: var(--paper); border: 5px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); width: min(400px, 100%); padding: 14px 16px 16px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.ban-scene { position: relative; width: 100%; height: 190px; overflow: hidden; border: 3px solid var(--ink); background: repeating-linear-gradient(45deg, #F0F0F0 0 14px, #E0E0E0 14px 28px); }
.ban-mark { position: absolute; left: 34%; bottom: -8px; width: 120px; transform: translate(-50%, 110%); animation: mark-up .45s .05s cubic-bezier(.2,1.4,.5,1) forwards; }
.ban-mark img { width: 100%; height: auto; display: block; }
@keyframes mark-up { to { transform: translate(-50%, 0); } }
.ban-hammer { position: absolute; z-index: 2; right: 13%; top: -9px; width: 97px; height: 162px; transform-origin: 50% 98%; transform: rotate(20deg); opacity: 0;
  animation: hammer .5s .35s cubic-bezier(.55,0,1,.45) forwards, hammer-bounce .25s .85s ease-out forwards; }
@keyframes hammer { 0% { opacity: 1; transform: rotate(20deg); } 100% { opacity: 1; transform: rotate(-46deg); } }
@keyframes hammer-bounce { 0% { opacity: 1; transform: rotate(-46deg); } 50% { opacity: 1; transform: rotate(-36deg); } 100% { opacity: 1; transform: rotate(-43deg); } }
.ban-stamp { position: absolute; z-index: 3; left: 66%; top: 78%; font-family: "Archivo Black", sans-serif; font-size: 36px; color: var(--red); border: 6px solid var(--red); padding: 0 12px;
  background: rgba(255,255,255,.82); letter-spacing: .02em; opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(3); animation: stamp .22s .88s cubic-bezier(.6,0,.9,.6) forwards; }
@keyframes stamp { to { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); } }
.ban-sub { margin: 4px 0 0; font-family: var(--font-mono); font-weight: 700; font-size: 14px; }
.ban-reason { margin: 0; font-weight: 700; color: var(--red); }
.ban-loss { margin: 0; font-family: var(--font-head); font-size: 26px; }
.ban-sub, .ban-reason, .ban-loss, .fx-ban-card > button { opacity: 0; animation: fade .3s 1.1s forwards; }
@keyframes fade { to { opacity: 1; } }
.fx-ban-card > button, .fx-win-card > button { width: 100%; margin-top: 6px; }

.fx-win { background: rgba(255, 212, 0, .35); animation: fx-in .2s ease-out; }
.fx-win-card { background: var(--yellow); animation: pop .4s cubic-bezier(.2,1.6,.5,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.fx-win-card img { width: 86px; height: 86px; animation: hop .6s .2s ease-out; }
@keyframes hop { 30% { transform: translateY(-18px) rotate(-8deg); } 60% { transform: translateY(0) rotate(4deg); } }
.win-k { margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.win-v { margin: 0; font-family: var(--font-head); font-size: clamp(34px, 4vw, 48px); line-height: 1; color: var(--green); background: var(--paper); border: 3px solid var(--ink); padding: 4px 12px; }
.win-x { margin: 0; font-family: var(--font-num); font-weight: 700; font-size: 18px; }

/* управление */
.panel-head .snd { min-height: 34px; padding: 2px 8px; background: var(--paper); color: var(--ink); border-color: var(--paper); box-shadow: none; font-size: 16px; }
.panel-head .snd[aria-pressed="false"] { opacity: .55; }
.ctrl-body { display: grid; gap: 12px; }
.fld { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
.step { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
.step button { min-height: 44px; padding: 0; box-shadow: 3px 3px 0 var(--ink); font-size: 20px; }
.step input[type=number] { text-align: center; font-weight: 700; font-size: 18px; -moz-appearance: textfield; }
.step input::-webkit-outer-spin-button, .step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=range] { width: 100%; height: 44px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 10px; background: var(--ink); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 30px; margin-top: -10px; background: var(--yellow); border: 3px solid var(--ink); }
input[type=range]::-moz-range-track { height: 10px; background: var(--ink); }
input[type=range]::-moz-range-thumb { width: 20px; height: 26px; background: var(--yellow); border: 3px solid var(--ink); border-radius: 0; }
input:disabled { opacity: .5; cursor: not-allowed; }
.chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.chips button { min-height: 38px; padding: 2px 0; font-size: 13px; box-shadow: 3px 3px 0 var(--ink); background: var(--paper); color: var(--ink); }
.presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.presets button { flex-direction: column; gap: 0; min-height: 54px; padding: 4px 2px; font-size: 10px; line-height: 1.1; letter-spacing: 0; box-shadow: 3px 3px 0 var(--ink);
  background: var(--paper); color: var(--ink); text-transform: none; font-weight: 600; }
.presets button b { font-family: var(--font-head); font-size: 18px; line-height: 1.05; }
.presets button.is-on { background: var(--yellow); }
.hint { margin: 0; font-family: var(--font-mono); font-size: 13px; border: 3px dashed var(--ink); padding: 8px 10px; background: var(--bg); }
.big { min-height: 60px; font-size: 20px; font-family: var(--font-head); letter-spacing: .02em; }
#btn-main.is-cash { background: var(--green); color: var(--paper); }
#btn-rand small { font-weight: 400; text-transform: none; font-size: 12px; }
#btn-rand { flex-wrap: wrap; gap: 4px; }
.credit { display: grid; gap: 6px; }
.credit .mono { font-size: 12px; }

/* лестница */
.bf-ladder .panel-head { padding: 10px 14px; }
.bf-ladder .panel-head h2 { font-size: 20px; }
.ladder { list-style: none; margin: 0; padding: 0; max-height: max(260px, calc(100vh - 560px)); overflow: auto; overscroll-behavior: contain; }
.ladder li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 12px; border-bottom: 2px solid var(--ink); font-family: var(--font-num); font-size: 14px; }
.ladder .n { font-family: var(--font-mono); font-size: 11px; color: #555; }
.ladder .x { font-weight: 700; }
.ladder .p { font-size: 12px; color: #333; text-align: right; }
.ladder li.is-done { background: #E7F6EE; }
.ladder li.is-done .x { color: var(--green); }
.ladder li.is-cur { background: var(--yellow); }
.ladder li.is-next { box-shadow: inset 5px 0 0 var(--ink); }
.ladder li.is-next .x::after { content: " ← следующий"; font-family: var(--font-mono); font-size: 10px; font-weight: 400; }

/* ниже игры */
.bf-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; margin-bottom: 30px; }
.hist td, .hist th { font-size: 14px; }
.hist .vbtn { min-height: 30px; padding: 2px 8px; font-size: 11px; box-shadow: 2px 2px 0 var(--ink); background: var(--paper); color: var(--ink); }
.tag-ban { background: var(--red); color: var(--paper); padding: 1px 6px; font-weight: 700; }
.tag-win { color: var(--green); font-weight: 700; }
.fair { margin-bottom: 10px; }
.fair-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 22px; }
.kv { display: grid; gap: 4px; margin-bottom: 12px; font-weight: 700; font-size: 14px; }
.kv small { font-weight: 400; font-family: var(--font-mono); font-size: 11px; color: #444; }
.kv code, .verify code { font-family: var(--font-num); font-size: 13px; background: var(--bg); border: 2px solid var(--ink); padding: 6px 8px; overflow-wrap: anywhere; word-break: break-all; font-weight: 400; }
.seed-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.seed-row button { min-height: 44px; box-shadow: 3px 3px 0 var(--ink); font-size: 13px; }
.fair-how h3 { margin: 0 0 6px; font-family: var(--font-head); font-size: 20px; }
.fair-how ol { margin: 0; padding-left: 20px; font-size: 14px; display: grid; gap: 6px; }
.fair-how code { font-family: var(--font-num); background: var(--bg); padding: 0 4px; }
.verify code { display: block; margin-top: 2px; }
.verify { margin-top: 12px; border: 3px solid var(--ink); padding: 10px 12px; display: grid; gap: 6px; font-size: 14px; }
.verify.is-ok { border-color: var(--green); background: #E7F6EE; }
.verify.is-bad { border-color: var(--red); background: #FDECEA; }
.verify .mini { display: grid; grid-template-columns: repeat(5, 18px); gap: 3px; }
.verify .mini i { width: 18px; height: 18px; background: var(--paper); border: 2px solid var(--ink); }
.verify .mini i.b { background: var(--red); }
.verify .mini i.o { background: var(--green); }

@media (max-width: 1180px) {
  .bf-game { grid-template-columns: minmax(0, 1fr) minmax(0, 320px); grid-template-areas: "hud hud" "board ctrl" "ladder ladder"; grid-template-rows: auto; }
  .bf-hud { grid-template-columns: 1.3fr 1fr 1fr 1fr 1fr; }
  .hud-main { grid-column: auto; }
  .bf-board { max-width: 640px; }
  .ladder { display: flex; max-height: none; overflow-x: auto; }
  .ladder li { flex: 0 0 auto; display: flex; flex-direction: column; gap: 0; border-bottom: 0; border-right: 2px solid var(--ink); padding: 6px 10px; min-width: 74px; align-items: flex-start; }
  .ladder li.is-next .x::after { content: none; }
  .ladder li.is-next { box-shadow: inset 0 -5px 0 var(--ink); }
  .ladder .p { text-align: left; }
}
@media (max-width: 720px) {
  .brand-row { width: 100%; justify-content: space-between; }
  .all-games { min-height: 40px; padding: 4px 10px; font-size: 14px; }
  .bf-title { margin-bottom: 14px; }
  .bf-title .slogan { font-size: 18px; line-height: 1.45; }
  .bf-game { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hud" "ladder" "board" "ctrl"; gap: 14px; }
  .bf-hud { grid-template-columns: repeat(4, minmax(0, 1fr)); box-shadow: 5px 5px 0 var(--ink); border-width: 4px; gap: 4px; }
  .hud-box { padding: 5px 6px; }
  .hud-k { font-size: 9px; letter-spacing: .02em; }
  .hud-v, .hud-main .hud-v { font-size: 16px; }
  .hud-main { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .hud-main .hud-v { font-size: 22px; }
  .hud-v { font-size: 14px; }
  .bf-ctrl .ctrl-body > .hint { order: -3; }
  .bf-ctrl .ctrl-body > #btn-main { order: -2; }
  .bf-ctrl .ctrl-body > #btn-rand { order: -1; }
  .bf-ctrl .ctrl-body > #gmsg { order: -4; }
  .fx { padding: 8px; align-items: flex-end; }
  .fx-ban-card, .fx-win-card { padding: 10px; gap: 4px; box-shadow: 6px 6px 0 var(--ink); }
  .ban-reason { display: none; }
  .ban-sub { font-size: 12px; }
  .ban-loss { font-size: 20px; }
  .fx-ban-card > button, .fx-win-card > button { min-height: 40px; margin-top: 2px; }
  .fx-win-card img { width: 60px; height: 60px; }
  .win-x { font-size: 14px; }
  .bf-ladder .panel-head { display: none; }
  .bf-ladder { box-shadow: 5px 5px 0 var(--ink); }
  .ladder li { min-width: 64px; padding: 5px 8px; font-size: 13px; }
  .bf-phrase { min-height: 42px; font-size: 15px; margin-bottom: 10px; }
  .bf-board { box-shadow: 6px 6px 0 var(--yellow), 6px 6px 0 4px var(--ink); gap: 5px; padding: 6px; border-width: 4px; }
  .face { border-width: 3px; }
  .face-front::after { border-width: 2px; box-shadow: 0 0 0 2px #3A3A3A; }
  .ok-lbl { font-size: 15cqi; margin-top: 3cqi; }
  .ban-scene { height: 132px; }
  .ban-mark { width: 84px; left: 32%; }
  .ban-hammer { width: 68px; height: 113px; top: -6px; right: 17%; }
  .ban-stamp { font-size: 26px; border-width: 4px; padding: 0 8px; }
  .bf-row { grid-template-columns: 1fr; gap: 22px; }
  .fair-grid { grid-template-columns: 1fr; }
  .top .hide-m { display: none; }
  .hist td, .hist th { font-size: 13px; padding: 7px 4px; }
}
