/* BlockFit-specific styles */
.game--blockfit { max-width: 560px; }

.bf-bar {
  display: flex;
  justify-content: center;
  margin: 4px 0 12px;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 6px;
  gap: 3px;
  background: var(--border);
  border-radius: var(--radius);
  user-select: none;
  touch-action: none;
}
.bf-cell {
  border-radius: 5px;
  background: var(--surface-2);
  transition: background 0.08s ease, transform 0.12s ease;
}
.bf-cell--filled { box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.25); }
.bf-cell--ok { box-shadow: inset 0 0 0 2px var(--success); background: color-mix(in srgb, var(--success) 22%, var(--surface-2)); }
.bf-cell--bad { box-shadow: inset 0 0 0 2px var(--danger); background: color-mix(in srgb, var(--danger) 18%, var(--surface-2)); }

/* ---- piece tray ---- */
.bf-tray {
  --tray-cell: clamp(18px, 5.2vw, 26px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 4vw, 28px);
  margin: 22px auto 0;
  min-height: 96px;
}
.bf-piece {
  display: grid;
  grid-template-rows: repeat(var(--pr), var(--tray-cell, 22px));
  grid-template-columns: repeat(var(--pc), var(--tray-cell, 22px));
  gap: 2px;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.bf-piece--empty { min-width: 40px; min-height: 40px; }
.bf-piece--dragging { opacity: 0; pointer-events: none; }
.bf-piece__cell {
  border-radius: 4px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ---- floating drag ghost ---- */
.bf-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  pointer-events: none;
  transform-origin: top left;
}
.bf-ghost__cell {
  position: absolute;
  border-radius: 6px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.3), 0 6px 16px rgba(20,24,49,0.25);
  transform: scale(0.92);
}

.keyhelp {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.78rem;
  margin-top: 16px;
}

@media (max-width: 640px) {
  .game--blockfit {
    height: calc(100dvh - 56px);
    display: flex;
    flex-direction: column;
    padding-top: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    overflow: hidden;
  }
  .bf-bar { margin: 4px 0 8px; flex-shrink: 0; }
  .hud { gap: 5px; flex-shrink: 0; justify-content: center; }
  .hud .stat { padding: 5px 9px; min-width: 64px; }

  .stage-wrap { flex: 1 1 0; min-height: 0; display: flex; align-items: center; }
  .board {
    width: min(94vw, 52dvh, 460px);
    max-width: none;
    margin: 0 auto;
  }

  .bf-tray { margin-top: 12px; flex-shrink: 0; min-height: 76px; }
  .keyhelp { display: none; }
}

@media (max-width: 340px) {
  .bf-tray { gap: 10px; }
}
